Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- htaccess won't catch rewrite URL's that include a % character


gizmoblaster - 9:09 pm on Jan 31, 2011 (gmt 0)


some of my URL's include query lines and some sites link to them replacing the ?, = and + with their % encoding, which means an URL like this:

http://www.example.com/exampleurl.php?item=this+item

ends up like this:
http://www.example.com/exampleurl.php%3Fitem\%3Dthis\%2Bitem

Result=
My server doesn't find them and Google marks them as 404.

No matter how I try to catch them for redirection, it doesn't work. I tried these, without success:

RewriteRule ^exampleurl.php\%3Fitem\%3D(.*)\%2B(.*)$ /index.php [R=301,L]

RewriteRule ^exampleurl.php%3Fitem%3D(.*)%2B(.*)$ /index.php [R=301,L]

RewriteCond %{QUERY_STRING} ^item%3D(.*)$
RewriteRule ... as usual...

Of course the last one can't work since the "?" isn't even in the url...

Does anybody have a solution? I've search the forums but don't even know exactly how to refer to the % special characters in my search terms.

[edited by: jdMorgan at 7:20 pm (utc) on Feb 7, 2011]
[edit reason] example.com to suppress auto-linking. [/edit]


Thread source:: http://www.webmasterworld.com/apache/4260794.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com