查询参数中的路径追加到.htaccess中的url
问题描述:
I am trying to make the below url
redirect to
http://localhost/base/list.php?r=path/to/redirect/1-2-master
I have tried this. But I am getting 404 error.
RewriteEngine On
RewriteRule ^(.*)base/(.*)/list.xh$ $1base/list.php?r=$2 [NC,L]
But when I tested on http://htaccess.mwl.be/ and it is working fine
我正在尝试制作以下网址 p>
http:// localhost / base / path / to / redirect / 1 -2-master / list.xh p> blockquote>
重定向到 p>
http://localhost/base/list.php?r = path / to / redirect / 1-2-master p> blockquote>
我试过这个。 但是我收到了404错误。 p>
RewriteEngine On RewriteRule ^(。*)base /(.*)/ list.xh $ $ 1base / list.php?r = $ 2 [NC,L] code> pre>
但是当我在上测试时 http://htaccess.mwl.be/ 并且工作正常 p> div>
答
Assuming there is no base/.htaccess
you can use this rule in root .htaccess:
RewriteEngine On
RewriteRule ^(base)/(.+)/list\.xh$ $1/list.php?r=$2 [L,QSA,NC]