Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect all pages to new domain

mod rewrite 301 redirect

         

thatsme

4:42 pm on Dec 26, 2009 (gmt 0)

10+ Year Member



I have a site which I want to redirect to a new domain with exactly same pages and folder structure. As per Google it says to do a 301 mod_rewrite redirect via Apache.

Now my question is the rule given below is suffiecient enough to move all pages and has no problem with Google (or work exactly as per Google instructions)?

RewriteEngine on
RewriteRule ^(.*)$ [newwebsiteurl.in...] [R=301,L]

wilderness

4:55 pm on Dec 26, 2009 (gmt 0)

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



I've used RedirectMatch successfully in the past (and never missed a beat with the search engines), whether that's the correct procedure or what you desire) is unknown.

RedirectMatch 301 /folder/(.*)$ http://www.example.com/folder/$1

RedirectMatch old threads [google.com]

[edited by: jdMorgan at 3:32 am (utc) on Dec. 27, 2009]
[edit reason] Formatting fixed, link simplified. [/edit]

g1smd

7:53 pm on Dec 26, 2009 (gmt 0)

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



It depends if both host names resolve to the same physical server or not.

I would point both host names at the same server and would use RewriteRule to create the redirect for all non-canonical host name requests.

That two-line piece of code is posted several times per week here. It has a preceding RewriteCond that checks what host name was requested.