Forum Moderators: phranque

Message Too Old, No Replies

How can I redirect "GET /%22" to my index page?

A bad link to my website is getting 404s from GET /%22

         

Wizcrafts

4:32 am on Jan 18, 2006 (gmt 0)

10+ Year Member



Somebody has a link to one of my websites, which while appreciated is causing 404 errors. The requested URL is %22 - as in GET /%22

I have tried to create both redirectmatch and rewrite rules to forward this request to my index page, to no avail. I looked up the URL Encoding equivilant and it represents a double quote ("). I have tried the following rules, none of which had any effect:

RedirectMatch 302 %22 /index.html

RedirectMatch 302 \%22 /index.html

RewriteRule \%22$ /index.html [R=302,L]

RewriteCond %{REQUEST_URI} ^\%22$
RewriteRule (.*) /index.html [R=302,L]

RewriteCond %{REQUEST_URI} ^%22$
RewriteRule (.*) /index.html [R=302,L]

RewriteCond %{REQUEST_URI} ^"$
RewriteRule (.*) /index.html [R=302,L]

Can anybody suggest a solution until I am able to track the website down and get them to fix the bad link?

Thanks, Wiz

jdMorgan

4:50 pm on Jan 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\%22
or
RewriteCond %{THE_REQUEST} ^GET\ /\%22

to catch the escaped quote character.

Jim

Wizcrafts

5:15 pm on Jan 18, 2006 (gmt 0)

10+ Year Member




RewriteCond %{THE_REQUEST} ^GET\ /\%22
RewriteRule (.*) ht*p://www.example.com/ [R=302,L]

Thanks Jim, that did the trick, with the RewriteRule shown above.

Wiz

extras

6:21 pm on Jan 21, 2006 (gmt 0)

10+ Year Member



Alternatively you can do like this:

# Since %22 will be decoded to a double-quote
# in REGEX match, you can use it escaped by a backslash
RewriteRule ^/*\" /index.html [R=302,L]