Forum Moderators: phranque

Message Too Old, No Replies

Redirect with } character in the URL

...using %7D on the redirect but apache ain't playin

         

Jack_Hughes

5:01 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have had a bad URL on my site for a day & google has picked it up & indexed it. It is now a part of their SERPS. I forgot to get rid of a trailing '}' character (long story) on one URL.

The URL is of the following form:

[domain.com...]

I want to put up a redirect, so I put the following in my .htaccess:

Redirect permanent /product.php/22/1/%7D [domain.com...]

Unfortunately, it isn't working...any ideas why?

jdMorgan

11:38 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jack_Hughes,

I suspect that mod_alias is testing that %7D as a literal, not as an escaped character.

I'd recommend trying RedirectMatch (see mod_alias) or mod_rewrite, both of which allow you to use regular expressions and to test escaped characters.


RedirectMatch 301 ^/product\.php/22/1/\%7D$ http://www.domain.com/product.php/22/1/

Jim

Jack_Hughes

11:12 am on Jan 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks jdMorgan.

I have a solution. I tried it just on the off chance, without much hope of success but hey ho, it worked?!

The code I used is:

RewriteRule ^/product\.php(.+)}$ [localhost:8080...] [R=permanent]

I just used the character '}' on the rule, not the encoded version (%7D). So, mod rewrite must decode the url before it is run through the rules.

Interesting...