我已经完成了这里的所有QA,但我没有做好。
我正在使用wamp,我的网站位于名为"site"的文件夹中。
我正在尝试重定向此
http://localhost/site/public/foo/bar/
至
http://localhost/site/foo/bar/
使用以下规则:
RewriteEngine On
RewriteBase /site/
RewriteRule ^public/(.*)$ /$1 [L,R=301,QSA]
但它重定向到
http://localhost/foo/bar/
若我在规则中明确提到它,那个么它就起作用了。
RewriteRule ^public/(.*)$ /site/$1 [L,R=301,QSA]
我可以在不显式添加/site/的情况下编写规则吗?
你能试试这个吗?
RewriteRule ^public/(.*)$ $1 [L,R=301,QSA]