Deciding that I really don’t have the desire nor free time to support multiple websites across multiple domains, I’ve started the process of copying all the content over from my unwanted WordPress sites to my primary WordPress site (at http://www.craiglotter.co.za) and then removing the unwanted installations. (Note: The WordPress Export/Import tools found under Tools work pretty damn well.)
However, because my unwanted sites still carry some decent link juice, SEO and SERP scores, I don’t necessarily want to lose all of that search engine goodness, and so set about setting up permanent redirection (301 HTML header) notices using the .htaccess file in the old accounts.
What this does is tell any search spider or browser where the content now sits, as well as the fact that it is a permanent redirect, meaning that hopefully the search engines update their indexes accordingly. Anyway, that’s the plan, but nevertheless, at least if you click in via an old link, you will still get transported to the desired content, albeit on a new domain! :)
To achieve this, first open your .htaccess file which you will find in the root of your WordPress installation directory. Note that this is a hidden file so you’ll need to edit it either via an FTP client or some other interface which allows you to list hidden files.
Once opened, be sure to remove all the WordPress rewrite rules which can be located between the “# BEGIN WordPress” and “# END WordPress” tags. Next, populate the .htaccess file with the following text at the top of the file:
<IfModule mod_rewrite.c> # Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^(.*)$ http://www.craiglotter.co.za/$1 [R=301,L] </IfModule> # BEGIN WordPress # END WordPress
Save the file and then try to hit an old URL like “http://www.codeunit.co.za/2010/01/16/php-simple-try-catch-example/” and note your browser automatically heading off to “http://www.craiglotter.co.za/2010/01/16/php-simple-try-catch-example/”.