We're currently working on a website that has rewritten URLs all over the place - they all work ok at the moment. I'm trying to add another one that redirects to an HTML anchor. The code snippet attached to this post is the rule as it stands now (it doesn't work). For example, the full page URL might be something like this (works):
There is an anchor in the file that is specified as <a name="post_comments">Some PHP here</a>
What I want mod_rewrite to do is accept a URL like this:
and rewrite it to:
Can someone help? #post_comments on the end of the URLs is uuuuuugly and I'd like them to say /comments instead. Feel free to rip apart the rule attached in the code snippet - it's just the results of me playing about with various combinations and is probably completely wrong.
Regular expressions still mystify me a bit so please bear with me on that ...
Thanks in advance!
# If we have 4 values and the last is the word 'comments' - rewrite to blog's comments
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/(comments)/$ /index2.php?group=$1&trip=$2&blog=$3#post_comments [NC,NE,L]