Forum Moderators: phranque

Message Too Old, No Replies

Redirecting dynamic URLs with underscore to another dynamic URL

         

liza28

12:03 pm on Dec 22, 2009 (gmt 0)

10+ Year Member



Hi! I just signed up and I'm just so happy to be a part of this forum. I hope I could be able to contribute as well but I feel that I will need your help more.

I've been browsing and reading a lot but I can't still make this redirect/rewrite work.

I have this dynamic page

[mydomain.com...]

One site has accidentally linked it using the

[mydomain.com...]

Take note of the underscore on the second URL.

Simple rewrite rule did not work. If anyone has a better idea to make this work, please let me know. The webmaster of the site is not responding for my request to change it. It would be nice to know if there is any way to do this. Any help from you will be very much appreciated.

g1smd

12:48 pm on Dec 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule can do this, as long as you test the parameter values using a preceding RewriteCond looking at the QUERY_STRING value.

liza28

1:06 pm on Dec 22, 2009 (gmt 0)

10+ Year Member



Hi! after a series of reading I wanted to share that I already found a fix for this using this rewrite rule

RewriteCond %{QUERY_STRING} partner=off20_
RewriteRule alt/Register.jsp [mydomain.com...] [R=301,L]

liza28

1:07 pm on Dec 22, 2009 (gmt 0)

10+ Year Member



you're right g1smd. Thanks for the response.

jdMorgan

10:13 pm on Dec 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your patterns need to be anchored to prevent potential unexpected operation and very-hard-to-find problems in the future. Also, literal periods (and other regex tokens) in patterns need to be escaped. Take a look at the regular-expressions tutorial cited in our Apache Forum Charter.

Jim

jdMorgan

2:14 am on Dec 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Something like this:

RewriteCond %{QUERY_STRING} ^([^&]*&)*partner=off20_(&.*)?$
RewriteRule ^alt/Register\.jsp$ https://www.example.com/alt/Register.jsp?ra30=true&partner=off20 [R=301,L]

Jim