在Apache上使用.htaccess进行网址重写时,如何使用#号作为锚点? [英] How to use # sign as an anchor while url rewriting with .htaccess on apache?
本文介绍了在Apache上使用.htaccess进行网址重写时,如何使用#号作为锚点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有.htaccess,可以很好地使用短重写规则,例如
i have .htaccess that works fine with shorty rewriting rules like
RewriteRule ^blog/(.+)$ blog_post.php?blogSEOBaslik=$1 [L]
但是这里有一个的页面。 php
包括通过< li>< a href =#resume>
命名锚的子导航。当我应用以下规则时:
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]
不像往常一样表现,标准 about.php#resume
锚点。
如何在URL重写规则中使用命名锚?
not behave as usual, standart about.php#resume
anchor do.
How do i use named anchors in url rewriting rules?
推荐答案
使用 NE
标志用于未编码
结果URL:
Use NE
flag for not encoding
the resulting URL:
RewriteEngine On
RewriteBase /BAH/
RewriteRule ^about/(.+)$ about.php#$1 [NE,L,R]
这篇关于在Apache上使用.htaccess进行网址重写时,如何使用#号作为锚点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文