How can I do this? (mod_rewrite)

Associate
Joined
26 Jun 2003
Posts
1,140
Location
North West
I have sum links on the main page:

/news/2
/news/5
/news/12

Now I want it so when a user clicks one of these links, they are taken to the news page and then taken to the anchor (named 2, 5 or 12).

I thought this would work but it isnt. I guess the # is starting a comment so how can I escape that?

RewriteRule ^news/([0-9]+)/?$ index.php?p=news#$1

( basically trying to get '?p=news#2' -> '/news/2' )

Thx
 
Last edited:
This will 100% not work. The fragment―the bit after the hash―is strictly client side, and without it in the URL the client won't skip down the page to the named element.
 
Back
Top Bottom