How to use # sign as an anchor while url rewriting with .htaccess on apache?

北战南征 提交于 2019-12-11 02:55:31

问题


i have .htaccess that works fine with shorty rewriting rules like

RewriteRule   ^blog/(.+)$   blog_post.php?blogSEOBaslik=$1   [L] 

But there is a page about.php which includes subnavigation via <li><a href="#resume"> named anchor. When i apply a rule like:

RewriteRule   ^about/(.+)$   about.php\#$1  [L]

not behave as usual, standart about.php#resume anchor do. How do i use named anchors in url rewriting rules?


回答1:


Use NE flag for not encoding the resulting URL:

RewriteEngine On
RewriteBase /BAH/

RewriteRule ^about/(.+)$ about.php#$1 [NE,L,R]


来源:https://stackoverflow.com/questions/21391449/how-to-use-sign-as-an-anchor-while-url-rewriting-with-htaccess-on-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!