I need to rewrite the URL of my site which contains %3F to ? and %3D to =
I have tried this rule:
RewriteCond %{HTTP_HOST} myhostname
RewriteRule ^(.*)%3F(.+)%3D(.+)$ $1?$2=$3 [L,R=301]
And this:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\%]+)\%3[Ff]\%3[dD]([^\ ]+)\ HTTP/
RewriteRule \.*$ %1?%2=$3 [R=301,L]
But none worked.
Help please. Thanks.
Just found the solution. Adding following rules did it:
Found it here: http://forums.iis.net/t/1193309.aspx?Need+help+transforming+3F+into+and+3D+into+
You are almost certainly getting a 403 error. The error is caused because ? is a banned file/directory name character on Windows and Linux. This means when Apache attempts to find a file or directory named "/document/root/index.php?blah" (after decoding) and it causes a 403 error. This is before the .htaccess files are read so you cannot use mod_rewrite in the .htaccess file to override this 403 error or an ErrorDocument defined in the .htaccess file to catch this error.
The only way to catch %3f is to use mod_rewrite or an ErrorDocument in a "VirtualHost" e.g. in httpd-vhosts.conf (or the main server configuration if there aren't any "Virtualhost"s e.g. in httpd.conf).