Reputation: 3
I have a GWT app in tomcat behind apache on linux. This maintains state inbound from a URL using parameters passed from a URL. See for example:
https://www.example.com/#anchor1?param1=foo¶m2=bar
I use a third party alerting package that is pushing a URL to the client but along the way it is encoding the URLs to
https://www.example.com/%23anchor1?param1=foo¶m2=bar
which means I am getting 404 errors.
I have searched high and low for solutions and do not have a clear answer that works.
As far as I can work out I need a simple rule that replaces all occurrences of %23 with # in a URL but there seems to be no clear consensus on something that will work (believe me I have tried everything).
What is the mod_rewrite rule to do this?
Thanks in advance.
Upvotes: 0
Views: 1875
Reputation: 17896
By the time mod_rewrite sees it, # is decoded. Normal # are never sent to the server, so it's a simple as:
RewriteRule ^(.*#.*) /$1 [R,NE]
I am assuming the browser needs the stuff after the #, so you have to redirect. "NE" stops the # from being encoded on the way out.
Upvotes: 2