1

为了创建 SEO url,我的 htaccess 看起来像这样:

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 我做错了什么?

4

1 回答 1

0

问题似乎是您的规则在同一个 URL 上一个接一个地应用。

在您的规则中添加一个附加条件以避免重复规则:

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

于 2013-10-23T13:20:40.983 回答