.htaccess 带有mod_重写的锚链接

.htaccess 带有mod_重写的锚链接,.htaccess,twitter-bootstrap-3,apache2,.htaccess,Twitter Bootstrap 3,Apache2,我正在一个php站点前面用.htaccess重写url 相关重写规则 RewriteRule ^tests$ /test.php [L] RewriteRule ^tests/([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$) /test.php?test=$1 [L] RewriteRule ^tests/([^/]+)/([^/]*)$ /test.php?test=$1&action=$2 [L] 当使用/tests/parameter1访

我正在一个php站点前面用.htaccess重写url

相关重写规则

RewriteRule ^tests$ /test.php [L]
RewriteRule ^tests/([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$) /test.php?test=$1 [L]
RewriteRule ^tests/([^/]+)/([^/]*)$ /test.php?test=$1&action=$2 [L]
当使用/tests/parameter1访问页面时,这可以正常工作,但是当使用/tests/parameter1/parameter2访问页面时,我的页面上的锚链接可以正常工作 停止工作。我正在使用引导选项卡

<li><a href="#add" data-toggle="tab">.....
<li><a href="#remove" data-toggle="tab">.....
因此,当使用一个参数访问页面时,它工作,但当使用两个参数访问页面时,选项卡停止工作


有什么想法吗?

你试过使用[QSA,L]而不是[L]你的重写规则吗?是的,我试过,但运气不好…@TheG是否将锚添加到url中?@RahilWazir是的,单击链接时它会添加到url中。这有效:/tests/parameter1anchor这不起作用/tests/parameter1/parameter2anchorted您在我的网站上配置的。您的配置似乎是正确的:您可以在此处运行测试: