Forum Moderators: phranque

Message Too Old, No Replies

rewrite help

how to pass # symbol in anchor tag

         

phparion

10:46 am on Mar 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi

I want to rewrite url like

http://www.example.com/word/word-day/48-2.html#reviews-31

I used this rule,

RewriteRule ^word/([^/]+)/([^/]+)-([^/]+)\.html#([^/]+)$ reviews.php?bid=$2&page=$3\#$4 [L]

but it is not working. the htaccess misses to read the url pattern and skip to the next rule.

thank you in advance for the great help

phparion

11:00 am on Mar 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



i got it working with this
RewriteRule ^word/([^/]+)/([^/]+)-([^/]+)\.html(.*)$ reviews.php?bid=$2&page=$3$4

but not sure if it is the efficient way to do it

jdMorgan

9:18 pm on Mar 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Be aware that named anchors are intended for use "inside" the browser only, and are usually not sent to a server when a link is clicked. The notable exception is Apple's Safari browser, which does send named anchors under certain circumstances -- Which I don't remember precisely enough to enumerate here.

Therefore, the only way you can be sure that your mod_rewrite rule will receive a #something anchor string in the URL is if that URL-string is the result of a previous rewrite on your server.

Best practice is to avoid any server-side dependency on named anchors.

Jim