hosts

Accessing Virtual Host from outside LAN

I'm setting up a web development platform that makes things as easy as possible to write and test all code on my local machine, and sync this with my web server. I setup several virtual hosts so that I can access my projects by typing in "project" instead of "localhost/project" as the URL. I also want to set this up so that I can acces...

How do make changes in drivers/etc/hosts take affect instantly with IE?

Firefox will notice this change immediately, but IE will need several minutes to take affect. Is there somehow I can make it work faster? ...

WAMP Virtual Hosts Not Working

Hi guys, please help me, I am pulling my hair out. I cannot get Virtual Hosts to work with WAMP. I have uncommented out this line: # Virtual hosts Include conf/extra/httpd-vhosts.conf This is my httpd-vhosts.conf file: # # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHos...

Alternate host/IP for python script

I want my Python script to access a URL through an IP specified in the script instead of through the default DNS for the domain. Basically I want the equivalent of adding an entry to my /etc/hosts file, but I want the change to apply only to my script instead of globally on the whole server. Any ideas? ...

/etc/hosts doesn't affect PHP

Hi! I'm having problems with the hosts file and PHP. When running the PHP code as root, the entries from /etc/hosts are read. But not when running the code as my user, or from apache. root@server:/# cat /etc/hosts 127.0.0.1 mydomain.com root@server:/# php -r "echo gethostbyname('mydomain.com');" 127.0.0.1 markus@server:/$ php -...

Editing hosts file to redirect url?

I know you can edit a hosts file to redirect a URL to an IP address as so: 127.0.0.1 google.com but how do you force a redirect to a URL instead of an IP address? e.g. mysite.com/welcome.aspx google.com The explicit URL doesn't work and assuming mysite.com's IP is 222.222.222.222, the following doesn't work either: 222.222.222.222...

Ignore hosts file?

I need to call a Response.Redirect method from C# but I need to do it in such a way that it ignores the Hosts file on windows for this call? For example, if on Hosts I have: 127.0.0.1 google.com and I call a Response.Redirect("google.com"), I need it to ignore the hosts just for this one call and actually go to google.com rather than...

How do I redirect a URL to another URL in the hosts file, rather than redirecting an IP to a URL?

How do I redirect a URL to another URL in the hosts file, rather than redirecting an IP to a URL? ...

IP Address to Hostname in Java?

My hosts file (C:\WINDOWS\system32\drivers\etc\hosts) has a bunch of IP Address to host name mappings: # Switches 192.168.200.254 sw-con-ctrl 192.168.201.253 sw-con-ctrl-2 192.168.201.254 sw-con-ctrl-1 # 192.168.188.1 sw-con-ctrl-blk-1 # 192.168.189.1 sw-con-ctrl-red 192.168.190.62 access-console # Rou...

Set cURL to use local virtual hosts

Using Apache or Ngnix I always create development sites based on real projects such as http://project1.loc which, after adding to my .hosts file, the browser has no problem using. However, when I attempt to make a cURL request (http://project1.loc/post.json) to that same URL I never get anything but a timeout. I'm assuming cURL doesn't ...

Port to Service Name in Java?

My services file (C:\WINDOWS\system32\drivers\etc\services) has a bunch of Port to Service mappings: echo 7/tcp echo 7/udp discard 9/tcp sink null discard 9/udp sink null systat 11/tcp users #Active users systat 11/udp users ...

Hosts file edit taking a long time to work?

Whenever I add an entry to the Hosts file on Windows, it takes a long time for the change to take place? I have tested using Firefox and IE and it seems to take around 5 minutes on both of them before the new IP/Domain entry on Hosts is recognised. Is there anything I can do to overcome this? Perhaps "refreshing" the cache in some way? ...

PHP Regular Expression to get IP address from /etc/hosts

I'm writing a PHP script that autoconfigures a device over Telnet, and I need to grab some IP addresses from /etc/hosts I need it to grab the IP address only, and assign it to a variable based on the hosts name. Example: 192.168.1.50 machine 192.168.1.51 printer 192.168.1.52 sigpad The PHP script should be like this: $machineip = "1...

System.Net.WebRequest not respecting hosts file

Is there a way to get a System.Net.WebRequest or System.Net.WebClient to respect the hosts or lmhosts file? For example: in my hosts file I have: 10.0.0.1 www.bing.com When I try to load Bing in a browser (both IE and FF) it fails to load as expected. Dns.GetHostAddresses("www.bing.com")[0]; // 10.0.0.1 WebRequest.Create("http://1...

Writing to a HOSTS file in Mac?

How do you programmatically add a new entry to the Hosts file in Mac? For example on Windows, you just open up a StreamWriter and output to the Hosts file. How do you do this on a Mac? ...

Windows Batch: How to add Host-Entries ?

hello, i want to use this batch script to add new entries into my host file automatically by using windows batch. my problem: the script just adds one line to the hosts file, also when i run the script as a administrator, so what's wrong? :( @echo off set hostspath=%windir%\System32\drivers\etc\hosts echo 62.116.159.4 ns1.intranet.de...

What others see as URL when we work with localhost changed in the hosts file?

Hello, Let me introduce to the situation we had to face it and the core of the question. We needed in our project to change the "localhost" to be something else like "newdomain-localhost.com", so we changed the hosts file (in Windows) and everything worked. We reached the wall of Facebook with its sharer, where you need to get the sit...

Sync /etc/hosts file across multiple machines

Does anyone know an easy way to synchronize your /etc/hosts file across multiple machines? I use a MacBook, a MacMini, a Windows Machine as well as a Linux VM to develop websites with so it would be ideal to have all of them have the same hosts config. ...

Multiple virtual hosts - all of those beyond the first are inheriting the DocumentRoot

Hey, I am trying to set up several virtual hosts in my apache httpd.config file. However it seems that if I change them round, they all inherit the DocumentRoot value from the first one. My VirtualHosts are as follows: <VirtualHost customerApp_Global:427> ServerName customerApp_Global DocumentRoot "C:/wamp/www/customerApp_v2" Direc...

How to detect if my website is relayed through the hosts file or an application

I have an application that connect to my website to verify user data (hardware id), but if somebody puts a line in the windows hosts file, it could be relayed to another site. Then it gets bad data and my app gets cheated (cracked). So, how to detect if my website is relayed through the hosts file or another application? ...