Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hosts File Redirect

Posted on 2010-08-26
5
Medium Priority
?
520 Views
Last Modified: 2013-12-04
I know how to redirect single URL's to an IP address, but is there a way I can redirect ALL url's to a certain IP address from the hosts file?
0
Comment
Question by:XGenwareS
  • 2
  • 2
5 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33538770
Probably not since the 'hosts' file is just a look up table for IP=URL pairs.  You would have to know all possible URLs.
0
 
LVL 2

Expert Comment

by:Nol888
ID: 33539042
The HOSTS file is an override of sorts for the Windows DNS system. Before sending a DNS request to your DNS server(s), it checks the hosts file to see if there's an entry for that hostname. By doing this, all requests to a given host are redirected to an IP. It is not URL specific at all.
0
 
LVL 2

Expert Comment

by:Pagefright
ID: 33539365
Try inserting the following line in the host file,

127.0.0.1 *
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33539374
By the way the author worded the question, I thought he was using 'URL' as a synonym for hostname.  If he is, you can't put all possible hostnames in the 'hosts' file.  And since it is just a list, it won't redirect anything that isn't in the list.
0
 
LVL 2

Accepted Solution

by:
Nol888 earned 2000 total points
ID: 33541262
>you can't put all possible hostnames in the 'hosts' file.
Absolutely correct. The HOSTS file doesn't support wildcards either, so he's pretty much out of luck.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outsource Your Fax Infrastructure to the Cloud (And come out looking like an IT Hero!) Relative to the many demands on today’s IT teams, spending capital, time and resources to maintain physical fax servers and infrastructure is not a high priority.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question