Forum Moderators: phranque

Message Too Old, No Replies

Redirect Whole Site to Single Page

How to redirect a whole site to a single page on another site.

         

ukao

1:22 pm on Jan 10, 2011 (gmt 0)

10+ Year Member



I have a site that is no longer being used. I want to redirect all the traffic to a single page on a different side.

Currently I have:
Redirect 301 / http://www.momentumlegal.com/


But it redirects oldsite.com/folder/ to newsite.com/folder/ when I want it to redirect oldsite.com/folder/ to newsite.com.

g1smd

1:49 pm on Jan 10, 2011 (gmt 0)

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



Redirect automatically re-appends path data.

Use RewriteRule instead.

ukao

2:46 pm on Jan 10, 2011 (gmt 0)

10+ Year Member



Thanks. I ended up with:

Options +FollowSymLinks
RewriteEngine on
rewriteRule ^(.*) http://www.momentumlegal.com/ [R=301,L]


I tested it and it seems to work.

g1smd

3:12 pm on Jan 10, 2011 (gmt 0)

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



Yep. That's the right code (do change rewriteRule to RewriteRule though).

If you have URLs with query strings, append a question mark to the end of the target URL in the rule to suppress them.