You are not logged in! If you have not registered yet then click here to join the community!

TOLRA Community Forums


Go Back   TOLRA Community Forums > Blogs > TOLRA Micro Systems Limited Blog

Notices

TOLRA Micro Systems Limited Blog
Rate this Entry

Hosting 2 or more domains on one hosting account

Submit "Hosting 2 or more domains on one hosting account" to Digg Submit "Hosting 2 or more domains on one hosting account" to del.icio.us Submit "Hosting 2 or more domains on one hosting account" to StumbleUpon Submit "Hosting 2 or more domains on one hosting account" to Google
Posted 05-02-2009 at 12:15 PM by Paul

Some web hosting accounts allow you to host multiple domains names each with a completely independent website on it, the following attempts to clarify how to do that without allowing content from addon domains to be visible via the main account domain. It also attempts to show that once correctly configured there's no difference between many domains on one account and many accounts on one server.

cPanel

We'll start with the case of cPanel based hosting, the following will work for all our shared hosting plans except our STARTER-1 plan. We assume in the following text that the account has the domain http://www.tolranet.co.uk/ assigned to it and that we wish to add the domain http://www.tolranet.com/ to the account.

Once you login to your cPanel account there is an option available, Addon domains, click the link and you are prompted to enter the information for the domain you wish to add to your account.

You start by entering the domain name, tolranet.com, into the New Domain Name box, when you press tab to move to the next field cPanel will automatically set the Document Root field to be public_html/tolranet.com.

The problem is that if you leave the Document Root as that then the web space for the new domain will be inside the web space for the accounts domain, this allows you to access it as both http://www.tolranet.com/ and http://www.tolranet.co.uk/tolranet.com/ this obviously has potential issues for duplicate content.

The solution is quite simple in that when adding the domain edit the Document Root field and remove public_html from it so it just becomes tolranet.com now your domain has it's web space outside of the accounts web space and so can only be accessed by its domain and not that of the account.

As a side note this is also true when creating sub-domains.

Now as you can't access the addon domains content via the main account domain there's no difference in hosting two or more domains on the same account or having two or more accounts on the same server, they both behave independently.

Other

If however your host is using a control panel which will not allow you to create web space for the addon domains outside of your main web space then you have to use rules in a .htaccess file placed within the folder assigned to each addon domain.

If you have the addon domain tolranet.com and it's web space is public_html/tolranet.com then in public_html/tolranet.com you'd place an .htaccess containing the following:

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

That rule simply states if the domain name used to access the site is not www.tolranet.com then do a permanent redirect to http://www.tolranet.com/

Again you can't access the content of the addon domain via the main domain because doing so will, in our example, cause the domain name to be www.tolranet.co.uk which in turn results in the .htaccess file redirecting the browser. So once again there's no difference in many domains per account or many accounts per server.

There is one issue however with addon domains being in folders of the main domain that you should be aware of and that is the rules in the .htaccess file in public_html are inherited by all the addon domains.

Moving Servers

With addon domains, if you ever wish to move your addon domains to different servers as your sites grow then you have move the site manually, that is backup the files and databases for the addon domain then upload them to the new location. If you use independent accounts then cPanel allows the server admin to trivially move an entire account to a new server often without you having to do anything.
Posted in Web Hosting
Views 4942 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

Post a Comment Post a Comment

All times are GMT +1. The time now is 12:06 PM.