2013-02-22 101 views

回答

3

注意不知道:锚文字#可以传递,但对替代无影响除非重定向是存在锚点的页面。尽管Apache无法将窗口滚动到锚点,但浏览器会在这种情况下执行此操作。下面是一些Apache information about redirecting anchors

您可以尝试这样的事:

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^site/(.*)/? site?page=$1 [NC,NE,L] 

地图

http://example.com/site/anything

http://example.com/site/?page=anything

字符串假定3210是固定的。

字符串anything可以含有锚#,它会在替代URL被传递。

+0

哦,谢谢,我明白了。我已经测试过,它仍然将页面向下滚动到锚点:D – ranisalt 2013-02-22 22:15:38