我的htaccess看起来像是为了创建SEO网址:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /app/
#marker share
RewriteRule ^share/(.*).html index.php?share=1&introsplash=0&markerid=$1 [L]
#marker share with map only.
RewriteRule ^map/(.*)/share/(.*) index.php?mapid=$1&markerid=$2&share=1&introsplash=0 [L]
#map only
RewriteRule ^map/(.*) index.php?mapid=$1 [L]
如果我创建一个指向
之类的锚的链接,问题就出现了<a href="#myanchor">go to my anchor</a>
页面重新加载到此网址:http://mydomain.com/app/#myanchor 我做错了什么?
答案 0 :(得分:0)
问题似乎是您的规则在同一网址上一个接一个地应用。
在规则中添加其他条件以避免重复规则:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /app/
#marker share
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^share/(.*)\.html$ index.php?share=1&introsplash=0&markerid=$1 [L,QSA]
#marker share with map only.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^map/(.*)/share/(.*)$ index.php?mapid=$1&markerid=$2&share=1&introsplash=0 [QSA,L]
#map only
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^map/(.*)$ index.php?mapid=$1 [L,QSA]
如果请求是针对有效文件,请注意RewriteCond %{REQUEST_FILENAME} !-f
,以避免下一个RewriteRule
。