How to Avoid Duplicate Content in Your Addon Domain

In fact, when you successfully create an addon domain in your existing cPanel, it also automatically creates a subdomain. Creating addon domain with the name “addondomain.com” in the “example.com” domain will automatically create sub domain “addondomain.example.com”. So, you can access your subdomain in several different ways such as : (1) addondomain.com (without or with www) (2) addondomain.example.com (3) example.com/addondomain.com.

The negative impact on your website when visitors access your same article in several URL is the duplicate content issue and may hurt your Google ranking and SEO. Again, for example, the addon domain “pojokasuransi.com” when installing in the main domain “anytutorial.net” can be accessed by some different URLs as follows:

-http://pojokasuransi.com
-http://pojokasuransi.anytutorial.net
-http://www.pojokasuransi.anytutorial.net
-http://www.anytutorial.net/pojokasuransi.com
-http://anytutorial.net/pojokasuransi.com

So, to avoid the duplicate content issue due to different URL with the same article, we can modify .htaccess file of pojokasuransi.com by following the steps below :

1. Go to your addon domain folder in your cPanel.

2. When shown “File Manager Direction Selection” dialog box, check in “Show Hidden Files (dotfiles)” to unhide .htaccess file.

3. Typical existing .htaccess file is as follows :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Modify the above .htaccess file by inserting the following scripts (after RewriteRule . /index.php [L] and before </IfModule>) :

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

So, the modified .htaccess file will look like the following :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} !^(www.)?pojokasuransi.com$ [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^(.*)$ http://www.pojokasuransi.com/$1 [R=301,NC,L]
</IfModule>
# END WordPress

4. Save your .htaccess and now test the addon domain of pojokasuransi.com by writing down all the variations of URL below :

-http://pojokasuransi.com
-http://pojokasuransi.anytutorial.net
-http://www.pojokasuransi.anytutorial.net
-http://www.anytutorial.net/pojokasuransi.com
-http://anytutorial.net/pojokasuransi.com

If no problems occur, the final result should be looked in one URL : http://www.pojokasuransi.com.

Leave a Reply