Canonical Parked Addon Domains Sub Domains .htaccess

richardmorris

Registered
Jul 13, 2013
1
0
1
cPanel Access Level
Website Owner
I want to make all of my parked and addon domains and sub domains canonical for better SEO on Google using the .htaccess file.

I used the following lines but it only works for my parked domains and sub domains but not for my addon domains and sub domains, see below:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Results:

Add on domains and sub domains failure:

addondomain.com permanently redirects to www.addondomain.com/addondomain.com/ Failure

admin.addondomain.com permanently redirects to www.admin.addondomain.com/addondomain.com/admin/ Failure

Parked domains and sub domains successful:

parkeddomain.com permanently redirects to www.parkeddomain.com Success

admin.parkeddomain.com permanently redirects to www.admin.parkeddomain.com Success

Objective:

One .htaccess file to control the canonical www in all of my parked and addon domains and sub domains.

But I don’t know the correct lines of code to use in my .htaccess file to make this work?

Please help.

Thank you,
Richard Morris
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
Hello :)

You may find more user input for custom rewrite rules directly from the Mod_Rewrite Forums.

Thank you.