homepage Welcome to WebmasterWorld Guest from 54.167.238.60
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
Forwarding 127.0.0.1?
inveni0




msg:4017178
 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 127.0.0.1, 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?

 

jdMorgan




msg:4017216
 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.

Jim

inveni0




msg:4017223
 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 127.0.0.1.

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.

mack




msg:4017229
 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.

Mack.

inveni0




msg:4017527
 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?

londrum




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

if you're redirecting to 127.0.0.1 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.

re3bo0t




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

Hi,

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 192.168.0.125. 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.

Morgenhund




msg:4054347
 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