将dir / dir重写为dir / dir?get = xx

时间:2018-12-04 17:18:21

标签: apache .htaccess mod-rewrite url-rewriting

我正在尝试解决这个问题,但我却无能为力。

我有这个网址

https://www.example.cz/xxx/settings.php?id=yy
https://www.example.cz/xxxx/settings.php?id=yyy
....

我想要这个

https://www.example.cz/xxx/settings/yy
https://www.example.cz/xxxx/settings/yyy
....

我尝试过的事情

RewriteRule ^(.*)/settings/(.*) $1/settings.php?id=$2 [NC,L]
RewriteRule xxx/settings/(.*) xxx/settings.php?id=$1 [NC,L]
RewriteRule ^xxx/settings/(.*) xxx/settings.php?id=$1 [NC,L]
RewriteRule /xxx/settings/(.*) /xxx/settings.php?id=$1 [NC,L]
RewriteRule ^settings/(.*) settings.php?id=$1 [NC,L]

什么都没用,但是如果我只这样使用它,就可以了。

RewriteRule ^xxx/(.*) xxx.php?id=$1 [NC,L]

预先感谢您的帮助。

0 个答案:

没有答案