Forum Moderators: phranque

Message Too Old, No Replies

Redirect All Parameters to Another domain

         

clickfire

5:48 am on Dec 28, 2010 (gmt 0)

10+ Year Member



I'm attempting to redirect all URLs with parameters to the main page of another domain.

Existing URL Example:
[olddomain.tld...]

Needs to Redirect to:
[newdomain.tld...]

This is the code I'm using but it isn't working. The domain changes in the browser but the parameters remain.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /support/demo\.php\?id=([^&]+)&series=([^&]+)\ HTTP/
RewriteRule ^(.*)$ http://www.newdomain.tld/ [R=301,L]

g1smd

12:28 pm on Dec 28, 2010 (gmt 0)

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



Add a question mark after the target URL to clear the parameters.

Your code does not redirect "all" parameters.

It only redirects for /support/demo\.php\?id=<anything>&series=<anything>

clickfire

4:24 pm on Dec 28, 2010 (gmt 0)

10+ Year Member



Ah, the question mark after the target URL made it work. Thanks!

g1smd

7:00 pm on Dec 28, 2010 (gmt 0)

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



Be careful to clearly comment your code so you know exactly what it does when you have to look at it again several months or years in the future.