Redirect requests from www.foo.com/bar.HTML to www.bar.com/foo.HTML?

1

I want to redirect specific page to another page. This means that requests for any other page on foo.com will function like normal, but if bar.html is requested =, it redirects to bar.com/foo.html.

This is pretty much the same problem as here Redirect specific url requests to local site except it seemed no one had a solution for what I'm asking here.

I'm also looking for an OS-wide solution.

jmasterx

Posted 2012-04-30T11:54:50.750

Reputation: 505

1After writing my answer I've noticed that you might want to perform client side redirection. Is that true? – amotzg – 2012-04-30T12:41:42.060

CNAME Record, .htaccess file, 302 redirect, HTTP redirect, javascript and more: http://en.wikipedia.org/wiki/URL_redirection. If you want it on a local machine, take a look at the hosts file.

– MaQleod – 2012-04-30T21:32:08.337

Answers

1

I would not suggest using meta refresh, as it has been deprecated by the W3C for violating accessibility guidelines: https://en.wikipedia.org/wiki/Meta_refresh

Instead, you should use an HTTP 301 code, but the implementation of it is dependent on the web server you use. You can read how to use a 301 redirect in Apache here: http://www.mcanerin.com/en/articles/301-redirect-apache.asp.

yutsi

Posted 2012-04-30T11:54:50.750

Reputation: 105

1

What you're looking for is a proxy server that will rewrite the url. Fiddler is the only one I can think of at the moment.

Ariel

Posted 2012-04-30T11:54:50.750

Reputation: 679

0

The simplest solution that does not even require server configuration, is to include the 'meta' HTML tag in the first page's header. And set the url attribute of the second page like so:

  bar.html :
  ...
  <head>
    <meta http-equiv="Refresh" content="0;url=http://bar.com/foo.html" />
  </head>
  ...

amotzg

Posted 2012-04-30T11:54:50.750

Reputation: 911