Using Mod_rewrite to rewrite an #anchor url?

I’ve searched the entire web and a bit. Just don’t know where or how to look for it.

What I want to do is the following:

Rewrite this : index.php?c=catalog&p=products#anchor
into something like /catalog/products/anchor/ and make the page jump to it’s anchor point.

I’ve done it like this, and that works but I want to lose the # :

Rewriterule ^/catalog/(.)/(.)/ index.php?c=catalog&p=$1$2
and I use $2 = #anchor.

But how to I get the anchor in my .htaccess file?

maybe this ?

Rewriterule ^catalog/([^/]+)/([^/]+)/?$ index.php?c=catalog&p=$1#$2 [L]

:slight_smile:

p.s.
i also removed
Rewriterule ^/catalog
and used
Rewriterule ^catalog

because within .htaccess you have to use the latter.

Unfortunately not. It seems Apache is parsing this as a comment.
But, then I tought i found a way. I replaced the # by %23 and that worked … it was just that the page didn’t load.

After a lot of searching I ended up with another users idea …

He told me the # never even leaves your browser. It never tells the server to jump to an anchor in the page. It’s client side. Ok … back to square 1 …