Addon domains Wildcarding support

Using a single web hosting account to host multiple sites

Addon domains Wildcarding support

Postby chandu » Fri Nov 17, 2006 4:17 am

Hi All,

I am having a hosting account with a dedicated IP and support for addon domains.

I am hosting a website on hosting root Domain1.com. I have setup wildcarded DNS and it is working fine.

I have some addon domains which are having their hosting paths under the root like

Domain2.com...............> Hosting root/domain2folder
Domain3.com...............> Hosting root/domain3folder

I have created wildcarded DNS entries for these addon domains also pointing to the same IP as the primary domain.

Now the problem is for all the subdomains of addon domains I am getting the main domains homepage as it is pointing to same IP.

Can I make changes to .htaccess of primary domain so that for all the addon domains it will go to their corresponding subdirectories instead of the root.

Thanks & Regards
Chandu
chandu
 
Posts: 4
Joined: Fri Nov 17, 2006 4:15 am

Postby richardk » Fri Nov 17, 2006 12:10 pm

What version of Apache is it?

Try:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.domain\.com$       [NC]
RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+\.[^\.]+)$ [NC]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)$ /%2/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby chandu » Fri Nov 17, 2006 10:32 pm

Thanks for the info.

I tried the above. Still all the subdomains of the addon domain are going to main domain.

I am running this on Godaddy. I don't know the Apache version.

In the above rewrite rule where are we mentioning the directory to which it needs to redirect to?
chandu
 
Posts: 4
Joined: Fri Nov 17, 2006 4:15 am

Postby richardk » Sat Nov 18, 2006 9:59 am

/%2/ is the directory. %2 holds the domain name (domain4.com from *.domain4.com). You could have /%2folder/ or anything like that.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby chandu » Mon Nov 20, 2006 4:30 am

Thanks richard.

I tried giving the hosting path in place of %2.

Now all the other addon domains and the main domain are also showing the addon domain homepage which is hosted on that path.
chandu
 
Posts: 4
Joined: Fri Nov 17, 2006 4:15 am

Postby richardk » Mon Nov 20, 2006 11:15 am

%2 should be in the path. It is the variable. Show me what you have.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby chandu » Mon Nov 20, 2006 8:23 pm

I added the following to the root htaccess file(Domain1).
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.domain2\.com$       [NC]
RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+\.[^\.]+)$ [NC]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)$ /domain2/$1 [QSA,L]


The hosting paths are like this :

Domain 1 :

/

Domain2 :

/Domain2/

Domain3 :

/Domain3/
chandu
 
Posts: 4
Joined: Fri Nov 17, 2006 4:15 am

Postby richardk » Tue Nov 21, 2006 8:47 am

The following should work:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.MAIN-DOMAIN-1\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+\.[^\.]+)$ [NC]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)$ /%2/$1 [QSA,L]

All you need to change is MAIN-DOMAIN-1.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 23 guests

cron