查询参数中的路径附加到.htaccess中的url


path in query parameter append to url in .htaccess

我试图使下面的url

http://localhost/base/path/to/redirect/1-2-master/list.xh

重定向到

http://localhost/base/list.php?r =路径//重定向/1-2-master

我试过了。但是我得到404错误。

RewriteEngine On
RewriteRule ^(.*)base/(.*)/list.xh$ $1base/list.php?r=$2 [NC,L]

但是当我在http://htaccess.mwl.be/上测试时,它工作正常

假设没有base/.htaccess,您可以在root .htaccess中使用此规则:

RewriteEngine On
RewriteRule ^(base)/(.+)/list'.xh$ $1/list.php?r=$2 [L,QSA,NC]