Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过.htaccess文件,使用根目录下的子目录在PHP和XAMPP中重新写入url_Php_Mysql_.htaccess_Url Rewriting_Xampp - Fatal编程技术网

通过.htaccess文件,使用根目录下的子目录在PHP和XAMPP中重新写入url

通过.htaccess文件,使用根目录下的子目录在PHP和XAMPP中重新写入url,php,mysql,.htaccess,url-rewriting,xampp,Php,Mysql,.htaccess,Url Rewriting,Xampp,我正在windows上运行XAMPP Server V.3.2.1。 我有.htaccess文件,其代码如下: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/?$ /?cmd=$1&caseSno=$2 [NC,L] RewriteCond %{REQUEST_FILENAME} !-f Rewri

我正在windows上运行XAMPP Server V.3.2.1。 我有.htaccess文件,其代码如下:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /?cmd=$1&caseSno=$2 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/?$ /?cmd=$1 [NC,L]
它在url中有两个参数,可以重写我的

?cmd=page_name&id=34
像这样

localhost/home/34
现在,我正在尝试访问位于子目录中的其他页面。我的目录结构如下:

Please view the following image for directory structure

请在这方面帮助我,我是.htaccess的初学者


提前感谢

将此规则放入
/court\u Admin/courtUsers/.htaccess

RewriteEngine On
RewriteBase /court_Admin/courtUsers/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ ?cmd=$1 [QSA,L]

我是否需要在每个子目录中放置相同的.htaccess文件,并且需要更改基本重写的行,如:RewriteBase/court\u Admin/recordRoom/?是的,这将是一种更干净的方法,而不是将所有规则填充到一个文件中。