.htaccess - rewriterule multiple domains same site

Support for webhosts that use CentOS
Post Reply
asingh
Posts: 2
Joined: 2011/04/18 02:36:14
Contact:

.htaccess - rewriterule multiple domains same site

Post by asingh » 2011/04/18 02:45:16

Hi

I have many different domains and I am trying to get them to all be able to use the same webserver instance but keep the URL typed in the browser address bar the same as it was.

so if I type in www.domain1.com or www.newsite.com or www.differentaddress.com or your.com or URLplace.ca

all use the same web server instance yet the end user would see the address they typed in being the same as they typed it.


I am hoping someone can help me with this please.


Thanks

User avatar
TrevorH
Forum Moderator
Posts: 27425
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: .htaccess - rewriterule multiple domains same site

Post by TrevorH » 2011/04/20 13:12:00

Since no-one else has replied to this... I think that what you are really looking for is to set up Apache name based virtual hosts.

logan
Posts: 64
Joined: 2008/08/01 16:40:34

Re: .htaccess - rewriterule multiple domains same site

Post by logan » 2011/04/20 20:32:46

This should be possible using the default host (even accessing by IP) so long as there's no redirects happening in the server config/code. If you're using VirtualHost's you could setup something like this:


ServerName www.domain1.com
ServerAlias www.newsite.com
ServerAlias www.differentaddress.com
ServerAlias your.com
ServerAlias URLplace.ca
...


Or just make sure the vhost you want answering for all domains is the first configured:


ServerName catchall
DocumentRoot /var/www/catchall/html



ServerName www.uniquesite.com
ServerAlias uniquesite.com
DocumentRoot /var/www/uniquesite.com/html



ServerName www.anothersite.com
ServerAlias anothersite.com
DocumentRoot /var/www/anothersite.com/html


www.domain1.com, www.newsite.com, and everything else should hit the first while uniquesite.com and anothersite.com go to their own unique vhost.

[url=http://httpd.apache.org/docs/current/mod/core.html#usecanonicalname]UseCanonicalName[/url] can also affect this, but it's off in every version of RedHat/RHEL/CentOS I've seen so any of the above should work.

asingh
Posts: 2
Joined: 2011/04/18 02:36:14
Contact:

Re: .htaccess - rewriterule multiple domains same site

Post by asingh » 2011/04/26 21:59:42

is there no way to do this with the .htaccess file?

I have redirects in place to redirect mydomain.com > www.mydomain.com , but I don't want other domains redirected to www.mydomain.com I want the domain/FQDN to remain in the URL for the customer.

I should add that I am in a Virtual environment using cPanel to host many web instances

Thanks

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

.htaccess - rewriterule multiple domains same site

Post by gerald_clark » 2011/04/27 15:29:38

You need to use the cPanel support you are paying for.
cPanel replaces CentOS's servers with their own.

Post Reply

Return to “CentOS 5 - Webhosting Support”