Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a Host File - Faking URLs

I'm trying to set up my development instances so that I can fake some urls that I own. My website has a number of url's and depending on the one you visit my site will act differently based on the domain..

ive edited my C:\WINDOWS\system32\drivers\etc\hosts File to contain something like below

127.0.0.1       localhost
127.0.0.1   SomeDomain.com
127.0.0.1   MyDomain.com

Now if I visit localhost everything works fine but when i try visit SomeDomain.com or MyDomain.com it produces couple different messages depending on browsers

Firefox - "Bad Request (Invalid Hostname)" Chrome - Asked for a username/password and just hitting on (not entering anything) products same result as firefox

IE6- "The page cannot be displayed"

any ideas?

like image 454
Steve Avatar asked Mar 02 '11 10:03

Steve


1 Answers

Your HOSTS file looks good. Also try adding the www version of each one, e.g.: 127.0.0.1 localhost 127.0.0.1 SomeDomain.com 127.0.0.1 www.SomeDomain.com etc

However, the problem is probably the setup of the web server. If you're using IIS, the problem probably is that you haven't set up host headers correctly.

like image 129
Jason Crease Avatar answered Oct 19 '22 06:10

Jason Crease