- Move the wordpress site to his new domain.
- Make sure everything is working, hint: update all url’s using Velvet Blues Plugin
- Point the old domain to a directory containing only two files:
A file named “index.php” containing:
<?php
$goto = $_SERVER["REQUEST_URI"];
header("HTTP/1.1 301 Moved Permanently");
header( "Location: http://new-domain-name.ch" . $goto );
?>
And a file named “.htaccess” containing:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Now all traffic will be redirected to your new site, telling google to transfer the old sites value.
Update: Canonical link rel
You could also add this code to your existing sites functions.php (inside your theme), instead of completing step 3.
add_action('wp_head','rel_canonical');
function rel_canonical()
{
$goto = $_SERVER["REQUEST_URI"];
$output = "<link rel="canonical" href="http://new-domain-name.ch/$goto" />";
echo $output;
}
This will dynamically output canonical links to all your WordPress pages.