Reputation: 3823
I'm not great at writing rewrite rules, but this has me confused. I want to make a rewrite rule for url's of the form
http://www.test.com/ENG/help.htm#PST
http://www.test.com/JPN/help.htm#GMT-0900
(where the second part is either ENG or JPN, then always help.htm, then # and a timezone abbreviation)
to redirect to
/en/help#PST
/jp/help#GMT-0900
I've tried lots of variations on the following:
RewriteRule ^/ENG/help.htm /en/help [NC,QSA,L]
just to see if I could get /ENG/help.htm to redirect to en/help, but for some reason this is always failing (no redirects are happening at all, so I guess for some reason it's not detecting the URL's I expect it to..?), and I'm getting really confused now as to what I'm doing wrong.
Upvotes: 1
Views: 23
Reputation: 786241
Remove leading slash from your URI and part after #
doesn't even reach to server so that cannot be added back in resulting URI. You can use this rule instead:
RewriteRule ^/?ENG/help\.htm$ /en/help#PST [NC,NE,L,R]
Upvotes: 1