Virtual Sub Domains & Domain Alias

Using a single web hosting account to host multiple sites

Virtual Sub Domains & Domain Alias

Postby jason1980 » Mon Oct 05, 2009 5:28 am

Hello All,
Is it possible to have a domain alias setup on a Virtual Subdomain.
For example,
I have a domain www.xyz.com .
I want to set it up as an alias on the sub domain http://123.abc.com
The subdomain is created using htaccess rewrites.

any ideas?

Cheers
Alan
jason1980
 
Posts: 2
Joined: Mon Oct 05, 2009 5:23 am

Postby richardk » Mon Oct 05, 2009 8:02 am

Post your current mod_rewrite.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jason1980 » Tue Oct 06, 2009 8:32 am

Hi,
Below is the current rewrite to create the virtual subdomains.
Thanks for your help

Jason
Code: Select all
RewriteCond %{HTTP_HOST}   !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC]
RewriteRule ^$ http://www.domain.com/generic-files.htm?id=%1 [L]
jason1980
 
Posts: 2
Joined: Mon Oct 05, 2009 5:23 am

Postby richardk » Tue Oct 06, 2009 10:24 am

You would need a specific rule (or maybe condition) for each domain
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# example.net "aliased" to 123.example.com
RewriteCond %{HTTP_HOST} !^(www\.)?example\.net$ [NC]
RewriteRule ^$ /generic-files.htm?id=123 [L]

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
RewriteRule ^$ /generic-files.htm?id=%1 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron