Forum Moderators: phranque

Message Too Old, No Replies

RedirectMatch permanent question

It works but not with the?

         

thaedge

6:11 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



Ok last question on this topic... I cant seem to figure out why or what Im doing wrong.

Im trying to redirect some 10 dynamic pages out of like 100 so I have to hardcode the values. But I cant get it to work with the?values=value in it.

Doesnt Work

RedirectMatch permanent ^/Page.html?pair=1234 /category/1234.html

Does Work

RedirectMatch permanent ^/Page.html? /category/1234.html

Is the only way to do this using the RewriteCond and RewriteRule?

RewriteCond %{QUERY_STRING} ^pair=1234$
RewriteRule ........

Thanks

?

jdMorgan

7:08 pm on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to match a literal question mark, it needs to be escaped, as do the literal periods: Otherwise, a "?" in a regular-expressions pattern makes the preceding character optional, and does not match a literal question mark:

RedirectMatch permanent ^/Page\.html\?pair=1234 /category/1234.html

If that still doesn't work, use mod_rewrite.

Jim

thaedge

7:26 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



I had the back slashes in previously and it didnt work. Guess its just gonna be a mod then.

Quirky son of a gun.

Thanks