I am looking to reroute one particular URL to another, for example : http://website.com/page1.html to http://website.com/page2.html on a third party server only on my machine. But I still want it to reply as if it was page1.html. Is there a way to do that on a client UNIX ?

Alex PS : If any clarification is required, please tell me

  • Are you looking to make this work such that if any program (wget, FireFox, etc) requests page1.html, the client machine automatically redirects the request to page2.html? Feb 18, 2011 at 21:11
  • What you're looking for is called a web proxy. Feb 18, 2011 at 21:37
  • justin : yes, basically, on my machine, as I would in /etc/hosts/, say "any requests to that url get changed to this one" and then any program that I open thinks he's calling one page while actually the OS is requesting another one gilles: no, a proxy is external and makes me run all my connection through it. /etc/hosts/ is just the OS requesting different host but the program still thinks it's calling the original URL, plus it's as simple as adding a line in /etc/hosts. I need something built-into unix. Feb 18, 2011 at 21:47
  • Please clarify "on a third party server only on my machine". Do you mean that you want to fool your machine (and only your machine) into retrieving page2 when you ask for page1? I assume by "third party server" you mean it is one you do not have control over. EDIT: Never mind, your comment clarifies this. Didn't see it before posting.
    – Wodin
    Feb 18, 2011 at 22:01
  • That's right, just fool my machine. Feb 18, 2011 at 22:05

1 Answer 1


I posted another comment yesterday, but it is not here now!

Anyway, it seems that a proxy is probably the way to go, despite your reservations.

A proxy can run on your machine, and therefore needn't be external.

Changing /etc/hosts to fool your browser into connecting to site2 instead of site1 just affects name resolution and is easy. Getting your machine to fetch page2 instead of page1 is much harder.

You could probably do it this way if you do not want to configure the clients to use a proxy:

  • Add website.com to /etc/hosts pointing at
  • Set up a reverse proxy on your machine and configure it to point to the real website.com.
  • Configure the proxy to fetch page2 when page1 is requested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.