13

I am going to build a website on a test server that will behave differently depending on which domain is used to access it (The real website will have multiple domains pointing to it).

But how will I be able to simulate the different domains on the test server?

JD Isaacks
  • 56,088
  • 93
  • 276
  • 422

3 Answers3

19

Just create fake domains pointing to your localhost in /etc/hosts file.

For example,

127.0.0.1   localhost domain1.com domain2.com

On Windows, this file is,

WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
ZZ Coder
  • 74,484
  • 29
  • 137
  • 169
4

you will need to edit your hosts file like ZZ Coder is saying. But to point the domain to a certain map you will need to edit the httpd.conf files. I add these kind of redirects in my httpd-vhosts.conf

<VirtualHost *:80>
    ServerName yourfakedomain.com
    DocumentRoot "/var/www/html/"
    <Directory /var/www/html/>
    Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>
RJD22
  • 10,230
  • 3
  • 28
  • 35
2

try to edit you hosts file http://en.wikipedia.org/wiki/Hosts_file

Claudio
  • 1,144
  • 3
  • 11
  • 21