Moving your site ~ Matt Cutts Google

Tell Google when your site moves ~ Matt Cutts Google

SEO: 301 Redirects C5 Plugin


Apache mod_rewrite

The Apache HTTP Server’s mod_alias extension can be used to redirect certain requests. Typical configuration directives look like:

Redirect permanent /oldpage.html
Redirect 301 /oldpage.html

For more flexible URL rewriting and redirection, Apache mod_rewrite can be used. E.g. to redirect a requests to a canonical domain name:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldsite\.example\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Such configuration can be applied to one or all sites on the server through the server configuration files or to a single content directory through a .htaccess file.

Could Off-Topic 301 Redirects Cause Panda/Penguin problems?

PHP Redirect
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location:” );

Redirect Old domain to New domain using htaccess redirect

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)$1 [R=301,L]

Please REPLACE in the above code with your actual domain name.

In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

To force a site to use the www version of it’s domain, I normally change my .htaccess file to look like:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]

I like this version of the redirect as it’s not specific to a site, so it can be dropped in without needing an edit every time.

I don’t know myself if using the BASE_URL define redirect sends a 301, hence why I use the htaccess redirect above instead.