Archive for November 21st, 2006

Adding multiple domains to cpanel using addon and redirection

Tuesday, November 21st, 2006

Question: how to use cpanel to host multiple web sites, each of which has multiple domans associated with it.

Example:

Assumptions: Name server setup points all of these domains to the name server where site1domain1.com etc. are hosted; site1domain1.com has content in /home/site1domain1/public_html; site1domain1 is “main” cpanel site, a Mother Site.

site1domain1.com has web content for site1domain1.com
site1domain2.com has pointer to site1domain1.com

site2domain1.com
site2domain2.com has pointer to site2domain1.com

/home/site1domain/public_html:                       site 1 domain 1′s content
/home/site1domain/public_html/site1domain2: site 1 domain 2 is pointer to site 1 domain 1
/home/site1domain/public_html/site2domain1: site 2 domain 1′s content
/home/site1domain/public_html/site2domain2: site 2 domain 2 is pointer to site 2 domain 1

Answer:

site1domain1.com is the host cpanel’s “main” site. It has a public_html directory under which its web code resides. Make sure none of the following directory names exist under public_html:

/home/site1domain1/public_html:
site1domain2
site2domain1
site2domain2

Task #1:
Make site1domain2.com point to site1domain1.com

Go to Addon Domains. Enter
site1domain2.com
site1domain2
a password here
Click Add Domain

This action creates the physical directory /home/site1domain1/public_html/site1domain2

New Domain Name:
Username/directory/subdomain Name:
Password:
 

Point site1domain2.com to site1domain1.com 
Go to Addon Domains.
At Redirect Domain to URL select site1domain2.com
Click Setup Redirect
Enter http://site1domain1.com/
Click Save

In browser go to site1domain1.com, it should show content in public_html
In browser go to site1domain2.com, it should redirect to site1domain1.com

Task #2:
Make site2domain2.com point to site2domain1.com

This is different than task #1 because there we were redirect the main hosting site’s domain. Here we are creating an add-on domain, redirecting it from the main site to the site2domain1 content, and then creating a pointer URL that redirects to site2domain1 as well.

Summary of tasks:
Create site2domain1 add on domain, redirect it so it displays site2domain1 content, create site2domain2 add on domain, redirect it so it lands at site2domain1.com

Create physical directory /home/site1domain1/public_html/site2domain1
Go to Addon Domains. Enter
site2domain1.com
site2domain1
a password here
Click Add Domain

Create physical directory /home/site1domain/public_html/site2domain2
Go to AddOn Domains. Enter
site2domain2.com
site2domain
a password here
Click Add Domain

 

Go to AddOn Domains
At Redirect Domain to URL select site2domain1.com
Click Setup Redirect
Enter http://site1domain1.com/site2domain1.com
Click Save
Go to AddOn Domains
At Redirect Domain to URL select site2domain
Enter http://site1domain1.com/site2domain1.com
Click Save