Search code examples
apache.htaccesshttpd.conf

Configuration for two domains on the same server


I have two domains pointed to the same server. olddomain.com is configured such that DocumentRoot is /var/www/html (Apache server) and finds all HTML and PHP files here. What is the simplest way to have newdomain.com find it's files (different from olddomain.com's) from a different folder (say /var/www/html2), such that when I type:

  • newdomain.com, it'll show a default index page
  • newdomain.com/foobar.htm it'll show newdomain.com/foobar.htm (including seeing this in the URL bar)

?


Solution

  • Create virtual hosts for each domain, very easy to do, Google it.