0

Do add on domains need a unique ip address or can they point to the same ip address as the main domain and use the .htaccess file to redirect to the subfolder?

Details:

I am trying to host two web applications on a single server. I setup the new domain name as an add on domain to my current server. In the process of getting it to work I replaced the new domain A record ip address with the current domain name ip address on the server thinking that it had to point to the same place.

Now when I type out the full www.domainname.com it just points to the same files as the other web application and if I type only domainname.com it gives me a warning and fatal error about failing to open a required file css_version.php.

I managed to get domainname.com to redirect to the proper add on subfolder using the .htaccess file but www.domainname.com still points to the other web application.

Can I fix this with the .htaccess file or does the domain name need to have a unique ip address for the server to differentiate between the two domains and if so how can I get the unique ip address it had back?

Andrew Bauer
  • 1
  • 1
  • 2

1 Answers1

0

What are talking about is a VirtualHost. VirtualHosts do not require a seperate IP address. Instead, the client sends a "Host" HTTP header to indicate the VirtualHost it is trying to reach.

Virtual hosts are usually configured in the apache server configuration (in /etc/apache/sites-available with symlinks to /etc/apache/sites-enabled), not in .htaccess files.

neuhaus
  • 3,886
  • 1
  • 10
  • 27