我把我的网站设计成OnePage设计。但是,我想继续使用我的旧URL。为了在我的新网站中导航,我使用了锚点。
我不能让Mod-Rewrite使用锚点工作。
我想重写的URL
www.mywebsite.com/nameOfAnchor
www.mywebsite.com/nameOfAnchor/目标为:
www.mywebsite.com/index.php?#nameOfAnchor我不能使用下面的代码(只调用index.php,而不是导航到锚点)来工作。
RewriteCond %{REQUEST_URI} /[^.]+[^/](|/)$
RewriteRule ^(.*)$ /index.php?#$1 [NE]如果我想要通过get传递一个变量,这个规则运行得很好
RewriteCond %{REQUEST_URI} /[^.]+[^/](|/)$
RewriteRule ^(.*)$ /index.php?variable=$1 [NE]但这并不能解决我的问题。有什么建议吗?
发布于 2016-11-08 21:06:48
您需要外部重定向。
RewriteRule ^(?!index\.php$)[^/]+/?$ /#$0 [NS,NE,B,L,R=301]https://stackoverflow.com/questions/39602437
复制相似问题