Alex Rivera | Logout

Editing hosts file to redirect url?

Asked 2010-07-16T15:34:27.437
37

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/welcome.aspx google.com

Edit
Report

1 Answer

11

No, but you could open a web server at, for example, 127.0.0.77 and use it to check if the Request URI is "/welcome.aspx"... If yes redirect to google, if not load the original site.

127.0.0.77      mysite.com
answered 2010-07-16T15:41:37.717

Your Answer