Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.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 Htaccess正在使用子目录中的参数重写根文件夹_.htaccess - Fatal编程技术网

.htaccess Htaccess正在使用子目录中的参数重写根文件夹

.htaccess Htaccess正在使用子目录中的参数重写根文件夹,.htaccess,.htaccess,我的url中有参数 https://www.example.com/subdirectory/reset-password/123/123 我希望它是https://www.example.com/reset-password/123/123 其中,第一123是第一参数,第二参数是123 我正在为以下链接制定规则: 我希望是这样 https://www.example.com/subdirectory/reset-password?p=123&q=123 到 我使用以下链接作为参

我的url中有参数

 https://www.example.com/subdirectory/reset-password/123/123 
我希望它是
https://www.example.com/reset-password/123/123

其中,第一123是第一参数,第二参数是123

我正在为以下链接制定规则: 我希望是这样

https://www.example.com/subdirectory/reset-password?p=123&q=123

我使用以下链接作为参考

使用以下方法:

RewriteEngine On
RewriteRule ^reset-password/([^/]*)/([^/]*)$ /subdirectory/reset-password?p=$1&q=$2 [L]
它将为您提供以下URL:


https://www.example.com/reset-password/123/123

什么是[L]的含义[L]标志代表“最后一个”并导致重写停止处理规则。这意味着,如果规则匹配,则不会处理其他规则。
RewriteEngine On
RewriteRule ^reset-password/([^/]*)/([^/]*)$ /subdirectory/reset-password?p=$1&q=$2 [L]