开发者

How to use mod_rewrite with anchors but no [R=301]

开发者 https://www.devze.com 2023-02-21 09:44 出处:网络
I have a website build on jQuery scrollTo plugin. Each page is accessible via anchor\'s, ie. www.domain.com/#page-one

I have a website build on jQuery scrollTo plugin. Each page is accessible via anchor's, ie. www.domain.com/#page-one and deeper ww开发者_JAVA百科w.domain.com/#page-one--some-content.

I'd like to create rule with mod_rewrite so address like

www.domain.com/page-one or www.domain.com/page-one/some-content

point to the above one. Its quite easy with [R=301] flag but I need my "clean" address /page-one/some-content to stay in address bar not changing to #page-one--some-content.

Why I need to change them? Because for some reasons I need to use alternative site for MSIE and Opera, kind of regular one with reloading every page. I need the same links for both sites which is obvious, I think.

I spent lots of time digging & reading about anchors in URL's and stuff, but I haven't reach my goal. If any one can help me, I'll appreciate!

Thanks, Kuba.


Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule (.*) /index.php#$1 [NE]

This works excellent for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消