homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum


 9:03 pm on Nov 1, 2009 (gmt 0)

I'm not sure if this is the right section...if not, please move.

I'm trying to block internet access to certain sites on my home computer. How can I edit the HOSTS file to do this? I have already told the hosts file to redirect to, but the catch is that I want the blocked access to deliver a message of my choosing.

Is there a way to direct these blocked sites to a page on my computer or website?



 9:34 pm on Nov 1, 2009 (gmt 0)

Either use an on-page script, or use Apache mod_rewrite or ISAPI Rewrite on IIS to rewrite such unwelcome requests to a file (e.g. page or script) of your choosing.



 9:58 pm on Nov 1, 2009 (gmt 0)

Sorry, I think I didn't explain myself very well.

I'm not running Apache.

Let's say I don't want anyone in my house visiting www.yahoo.com. So, I add the appropriate data to the hosts file so that www.yahoo.com gets patched to

Now, let's say someone tried to open Firefox and visit www.yahoo.com. Instead of just giving a server can't be found error, I'd like it to display a webpage I've created.

I assume that I could do this with pretty decent ease in Apache, but I don't need Apache on my home pc...so I'd like to keep it simpler, if possible.


 10:08 pm on Nov 1, 2009 (gmt 0)

If you have a website, upload the page you want to show there, and use the hosts file to point traffic for blocked domains to that location.

This would only work for the machines you edited the hosts file. Some routers have this feature built in, consult your router manual.



 3:14 pm on Nov 2, 2009 (gmt 0)

I've attempted redirecting to a host name (http://www.mysite.com), but it doesn't work. Is there a special format?


 3:25 pm on Nov 2, 2009 (gmt 0)

if you're redirecting to all you really need to do is install apache, which is easy, and then put an index.html file in the htdocs folder containing whatever you want to say.

you'll have to remember to set it up so apache starts automatically everytime a user logs-on.

but maybe it would be better to redirect to a different page on localhost instead. because if the browser's homepage is set to localhost, then they'll see the page everytime they start the browser up.


 2:45 pm on Nov 18, 2009 (gmt 0)


Sorry, maybe I'm hijacking your topic inveniO. But I have similar problem with this. Before that, I'm still running on Virtual machine which is VirtualBox. Lets say I have 3 servers (server A.B and C) and 1 client. Server A is the primary server to run the website (ex. foo.com) and the IP Address is So when the client type server's A IP Address, it will see the site's page. My question is, when the server A down, I want to change to server B which has the same name like server A. So it means the connection to server A has been blocked and change it to server B or C. How to do that? I'm running LAMP on Ubuntu host and guest.

Thanks in advanced.


 2:24 pm on Jan 5, 2010 (gmt 0)

inveni0: you'll cannot achieve this with HOSTS--it works on TCP/IP level, whereas you need HTTP level. Most SOHO hardware routers have this feature (and give you home computer extra protection from outside attacks), or you need to look for some firewall program to install on your home computer.

re3bo0t: you'll need some sort of load-balancing technique: either an appliance (look for BigIP, Barracuda Load Balancer etc), or you can play with Apache's mod_proxy & mod_status.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved