Domain alias - yes or no?

Permabanned
Joined
9 Aug 2008
Posts
35,707
If I was you I would do a redirect. You can do this via a simple meta data script. Not so sure if this has SEO problems though but this is the way I would do it a a quick solution. Try to make sure you use one url on business cards e.t.c and over time expire the other domains if you wish.

Code:
 <meta http-equiv="Location" content="http://www.pauldoranpictures.com">
 
Soldato
Joined
6 Aug 2007
Posts
2,516
The correct way is to use a 301 redirect.

"If you need to change the URL of a page as it is shown in search engine results, we recommend that you use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location."

Source: https://support.google.com/webmasters/answer/93633?hl=en
 
Permabanned
Joined
9 Aug 2008
Posts
35,707
The correct way is to use a 301 redirect.

"If you need to change the URL of a page as it is shown in search engine results, we recommend that you use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location."

Source: https://support.google.com/webmasters/answer/93633?hl=en

oh well there you go. Something I never knew.

PHP SCRIPT
PHP:
<?
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: http://www.new-url.com" ); 
?>

SOURCE: http://www.webconfs.com/how-to-redirect-a-webpage.php
 
Caporegime
Joined
18 Oct 2002
Posts
29,491
Location
Back in East London
301 means "permanently moved, and you should refer to this resource using the address I am about to give you in the future." I.e. the browser should replace "http://www.pauldoranpictures.com/" with "http://www.pauldoran.co.uk/" whenever a user browses to "http://www.pauldoranpictures.com/" and your server returns a 301 with "http://www.pauldoran.co.uk/".

If you use a 302, that's a "resource found and/or redirected temporarily - please continue to refer to this resource using the current url" and the browser won't change it. In other words just an alias.

Assuming apache do this for your vhost:

Code:
<VirtualHost *:80>
  ServerName  addressyouwanttoredirect.com
  RedirectMatch permanent ^/(.*) http://addressyouwanttoredirectto.com/$1
</VirtualHost>

If you don't have direct access to vhosts, then you can wangle it in the .htaccess. If they are separate sites, it's a bit easier with:

Code:
Redirect 301 / http://addressyouwanttoredirectto.com/

If they are on the same server/host, then you'll need to use a rewrite rule and add a condition. Don't worry, it will still use the 301:

Code:
RewriteCond %{http_host} addressyouwanttoredirect.com$ [nc]
RewriteRule ^(.*)$ http://addressyouwanttoredirectto.com/$1 [r=301,nc,L]
 
Caporegime
Joined
18 Oct 2002
Posts
29,491
Location
Back in East London
No, mostly down to preference. The vhost config assumes you have access to configure vhosts, and would be my preference. The middle option will only work if you have separate servers for the domains. I.e. you can only use that on the server for your old domain. If you put it on the one that's hosting the new domain it will infinitely loop. The third will work on either shared or dedicated.

Naturally they should be added to whichever server receives the old domain's requests.
 

daz

daz

Soldato
Joined
18 Oct 2002
Posts
24,079
Location
Bucks
Normally the best thing to do is to add the aliases, and then add something like this in the .htaccess:-

RewriteCond %{HTTP_HOST} !^www.yoursite.com$ [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]

Where 'www.yoursite.com' is the canonical domain you want to have for your site, any other domains that are pointed to that vhost will then automatically re-direct to the canonical domain. This also avoids having to add a specific rule for each extension, TLD or domain variation that you buy.

The only issue is that you should just check that your CMS/application isn't already doing this - some like Magento will automatically re-direct to what you have configured as your site URL if a request comes in for any other domain.
 
Back
Top Bottom