How to use htaccess to rewrite url to html anchor tag (#)

Posted by Lee L on Stack Overflow See other posts from Stack Overflow or by Lee L
Published on 2010-05-20T09:33:51Z Indexed on 2010/05/20 9:40 UTC
Read the original article Hit count: 604

Filed under:
|
|
|

Hi -

I have a situation where I want to take the following URL:

/1/john

and have it redirect using Apache's htaccess file to go to

/page.php?id=1&name=john#john

so that it goes to an html anchor with the name of john.

I've found a lot of reference to escaping special characters, and to adding the [NE] flag so that the redirect ignores the # sign, but these don't work. For example, adding [NE,R] means that the URL just appears in the browser address as the original: http://mysite.com/page.php?id=1&name=john#john.

Any help would be appreciated.

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about rewrite