Search left

Archive for August, 2009


Plesk Linux Domain Alias 301 HTTP Redirect



The problem: A Plesk client has one or more domain aliases defined in Plesk Linux. In this article we’ll suppose that the main domain is my-domain.com, having my-domain.net as a domain alias.

In this case, the domain alias my-domain.net will appear as separate site to search engines (Google, Yahoo, MSN and so on). This situation can create duplication issues and can affect the PageRank of the main site.

The solution: We’ll use an Apache .htaccess file to create a Search Engine Friendly 301 redirect from the domain alias (my-domain.net) to the main domain (my-domain.com).

Open (or create if it doesn’t exist) the Apache .htaccess file from the root folder (usualy /httpdocs) and add on top of it:

RewriteEngine on

# 301 Redirect requests from my-domain.net to my-domain.com
RewriteCond %{HTTP_HOST} !^(www\.)my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.my-domain.com/$1 [L,R=301]

The RewriteCond line checks to see if the HTTP_HOST is NOT my-domain.com. If this is true, Apache will do a permanent (301) HTTP redirect to http://www.my-domain.com/$1, where $1 is the part that was after the HTTP_HOST.

Now, watch the PageRank of the main domain :)


Posted on August 13th, 2009 in Linux, Plesk | 6 Comments »



 


Footer left Footer right