cPanel is a (SEO) developers nightmare

Posted on May 28th 2009 9:55am Thursday, by Blaine

A few weeks back I ran into a problem on a clients cPanel account where there could be SEO issues. The problem is that when you are creating an add-on domain cPanel creates a sub domain of the main domain as well. There is a way to fix this through a htaccess rewrite. What were they thinking when they built it this way? Also, If you are doing a domain to domain redirect in cpanel this is where the problem is the worst.

First, when you are creating an add-on domain, remove public_html from the document root. The public_html is the folder you use for your account’s primary domain html files. On some host they have do not allow you to put the add-on domain outside of the public_html folder.

It seems that this directory does not appear on my main domain, however, I would not put it past you to make sure it does not work on your system as well. Just go to your-domain.com/add-on-domain.com and make sure it does not load the website. If in fact it does show the website and does not redirect you we can fix this in the htaccess, all of which is below.

Second, creating the add-on domain has just created a subdomain of your primary cPanel domain and whatever usename you chose for the add-on domain. You cannot delete this subdomain. You will get this error:

“Sorry, the subdomain fishtank cannot be removed because it is linked to the addon domain fishtank.me. You must first remove the addon domain.”

So this as well has to be fixed with the htaccess.

In this image, bladesling.com is an example of the proper way to setup the document root. It also shows you the sub domain that needs to be redirected. We will fix this in the htaccess.

Lastly, if you are doing a domain to domain 301 redirect, wow, I feel for you. Physical hosting for something so simple is rediculous. But lets just solve all these problems with 1 htaccess file.

The .htaccess Fix

This file will vary depending on which problems you are having. Any line starting with # is a comment, read it to figure out what the line below it is doing. If you are not having that particular issue, just delete that line. Upload a file named “.htaccess” to add-on domain’s main folder. This is not a .txt file, the extention is .htaccess, and there is no name.

# This allows for the below to work.
RewriteEngine on
# This fixes the issue with the sub domain of the main domain
RewriteCond %{HTTP_HOST} ^fishtank.blaineehrhart.com$ [OR]
# If you are doing a domain to domain redirect, this redirects the www if typed in
RewriteCond %{HTTP_HOST} ^www.fishtank.me$ [OR]
# This redirects the non www version of the website
RewriteCond %{HTTP_HOST} ^fishtank.me$
# This does a 301 redirect to the domain of your choosing, this is required for the above to work.
RewriteRule ^.*$ "http\\:\\/\\/www\\.blaineehrhart\\.com\\/" [R=301,L]
# your-domain.com/add-on-domain.com issue- if it happends to come up.
redirect 301 /add-on-domain.com <a href="http://www.add-on-domain.com">http://www.add-on-domain.com</a>

On a side note:

cPanel seems to also force you to point your name servers before you setup an addon domain. In my opinion- moving a site should be flawless, no downtime and here they are trying to make it harder for me to accomplish that. The below IPs were the correct IPs and since I have a WHM and I can enable an option that makes this possible. But for those having this problem and do not have a WHM, I have no answer.

Error from park wrapper: Using nameservers with the following IPs: XX.XX.XX.XX,XX.XX.XX.XX Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver.

Under tweat settings in the WHM, check the option that says: Allow Creation of Parked/Addon Domains that resolve to other servers (i.e. domain transfers) [This can be a major security problem. If you must have it enabled, be sure to not allow users to park common internet domains.]

Leave a Reply