Domain name migration

I just migrated my website (the one you’re reading actually!) from www.colomern.net to the new URL www.ncolomer.net. Normally, you should have felt no difference thanks to some tips gleaned here and there on the web.

My first approach was to put a custom index.php file on the old domain that permanently redirects all root requests to my new domain:

<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.ncolomer.net/");
exit();
?>

But what about the old URLs that map my blog articles, the one that was indexed by Google? In a such situation, the best way to do the least possible harm (ie. do not lost SEO robots) is to redirect all old URLs to my new domain. This can be done using a simple .htaccess containing the following:

RewriteEngine on
RedirectMatch 301 ^(.*)$ http://www.ncolomer.net$1

Thus, all requests on colomern.net/2011/03/bonjour-tout-le-monde for instance will instantly be redirected (301 Moved Permanently) to ncolomer.net/2011/03/bonjour-tout-le-monde.

Leave a Comment