I've to domain names pointing to the same IP.
What I want to do is:
When visited by domain_name1,make document_root:/usr/local/apache/htdocs1
when visited by domain_name2,make document_root:/usr/local/apache/htdocs2
how to do this job?
I've to domain names pointing to the same IP.
What I want to do is:
When visited by domain_name1,make document_root:/usr/local/apache/htdocs1
when visited by domain_name2,make document_root:/usr/local/apache/htdocs2
how to do this job?
(Note: this question should really go on ServerFault)
What you want to achieve is known as name-based virtual hosting.
Example of this from the referenced page:
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost> <VirtualHost *:80> ServerName www.otherdomain.tld DocumentRoot /www/otherdomain </VirtualHost>
Using Virtual Hosts (samples)
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain1.com
DocumentRoot /usr/local/apache/htdocs1
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain2.com
DocumentRoot /usr/local/apache/htdocs2
</VirtualHost>