I have a customer that started his small business using an url called "firstname-lastname.ch". Since he was lucky enough to grow and now wants a proper URL, he would like to have another URL for his website called "businesstype-lastname.ch"

What would be the best way of achieving that without having too much administration and SEO issues.


  • PS both should be, SEO wise, as visible as possible. – mebu83 Jul 6 '15 at 11:35
  1. Move the wordpress site to his new domain.
  2. Make sure everything is working, hint: update all url's using Velvet Blues Plugin
  3. Point the old domain to a directory containing only two files:

A file named "index.php" containing:

$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]

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.


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.

  • This will work, I was hoping to add a canonical tag to all pages via a plugin. – mebu83 Jul 7 '15 at 5:13
  • See my updated answer, which includes your request :) – Jeppe Jul 7 '15 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.