- Code: Select all
http://www.mysite.com/index.php?var=1 //what it should be
http://www.mysite.com/index.php%3Fvar=1 //what it is
Depending on the link, they're either 404ing or 401ing, neither of which are good.
There are 1 of 2 things I'd like to do, both using htaccess:
1. Replace the %3F with a ?, so at least the link will go through
or
2. Crop the link at the %, so that http://www.mysite.com/index.php%3Fvar=1 will become http://www.mysite.com/index.php
Either solution would be satisfactory.
For #1, I've tried a simple RewriteRule, but mod_rewrite treats % differently, even if escaped.
I've come close with #2. Here's a code that works with %20s:
- Code: Select all
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^%]+)\%
RewriteRule .* http://www.mysite.com/%1 [R=301,L]
but I can't get it working with %3Fs.
I've scoured Google and Yahoo, but this seems to be a unique problem. Any help would be greatly appreciated. And a solution would earn someone a virtual pint.