Forum Moderators: bakedjake

Message Too Old, No Replies

How to 301 redirect from an old to new site?

         

rfgdxm1

4:01 am on Mar 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the situation. Someone I know has a site at [example.com...] on a Unix box, and they have set up a mirror site at [someotherdomain.com....] The idea is to take down the old site, and redirect anyone going to that site to the proper URL on the new site. What is the syntax for the .htaccess file to accomplish this?

jamie

10:51 am on Mar 25, 2005 (gmt 0)

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



hi, i use

RewriteEngine On
RewriteRule ^(.*)$ [newsite.com...] [R=301,L]

the ^(.*)$ captures any URL on the old site and appends it, $1, to the new site

there's lots of examples of this in the apache forum

hth

(edited for clarity)