.htaccess Htaccess正在使用子目录中的参数重写根文件夹
我的url中有参数.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 到 我使用以下链接作为参
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]