Forum Moderators: phranque

Message Too Old, No Replies

Redirect not working

         

Dell Hershwtized

10:17 am on Nov 28, 2006 (gmt 0)

10+ Year Member




I want to redirect page called

index.php?id=20003 to
[abc.com...]

and say for
index.php?id=20004 to
[abc.com...]

i try this, but not working

Redirect 301 ^index.php?id=20003$ [abd.com...]

any ideas...

Thanks in advance

Dell Hershwtized

2:05 pm on Nov 28, 2006 (gmt 0)

10+ Year Member



Now i had try this

RewriteCond %{query_string} ^id=20003
RewriteRule ^index\.php$ [abc.com...] [R=permanent,L]

It is working but after redirecting it appends the id in the end.
[abc.com...]

Thats i DO NOT want. is there any way to not to append the query string at last.

--Tbanks

jdMorgan

3:14 pm on Nov 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a question mark to the end of the substitution URL to clear the query string:

RewriteCond %{QUERY_STRING} ^id=20003&?
RewriteRule ^index\.php$ http://www.example.com/articles/filing-bankruptcy.p[b]hp?[/b] [R=301,L]

The trailing optional ampersand pattern "&?" on the query string match will prevent your pattern from matching longer id numbers, for example, in this case, id=200030.

Jim