[英]htaccess removing part of url path and stay at base (at localhost)
I've gone through all QA here, but I am not getting it right. 我已经在这里进行了所有质量检查,但是我做错了。
I am using wamp and my site resides in a folder named 'site'. 我正在使用wamp,我的网站位于一个名为“ site”的文件夹中。
I am trying to redirect this 我正在尝试重定向
http://localhost/site/public/foo/bar/
to 至
http://localhost/site/foo/bar/
using these rules: 使用以下规则:
RewriteEngine On
RewriteBase /site/
RewriteRule ^public/(.*)$ /$1 [L,R=301,QSA]
but it redirects to 但它重定向到
http://localhost/foo/bar/
If I explicitly mention it in rule then it works. 如果我在规则中明确提到它,那么它将起作用。
RewriteRule ^public/(.*)$ /site/$1 [L,R=301,QSA]
Can I write a rule without explicitly adding /site/ ? 是否可以在不显式添加/ site /的情况下编写规则?
你可以试试这个吗?
RewriteRule ^public/(.*)$ $1 [L,R=301,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.