Best way to simulate a domain?
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 rea开发者_运维百科l website will have multiple domains pointing to it).
But how will I be able to simulate the different domains on the test server?
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
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>
try to edit you hosts file http://en.wikipedia.org/wiki/Hosts_file
精彩评论