rjv
rjv

Reputation: 6766

Redirection from one server(port) to another

Is there a way to redirect from one server port to another?
I have two servers running on my system: Apache on port 80 and Python CGI on port 8000
How can I create a redirect from a page running on Apache to one on CGI and vice-versa?

<body onload="document.location='127.0.0.1'">

did not work.

Upvotes: 1

Views: 937

Answers (1)

ZelluX
ZelluX

Reputation: 72655

Actually it has nothing to do with different ports, it is just all about redirection. Here are two methods for you.

Redirction with .htaccess: create a file named .htaccess and write a line like

Redirect /redirect.html http://127.0.0.1:8000

in it. Then all access to /redirect.html will be redirected to http://127.0.0.1:8000. Please make sure your server support .htaccess before you choose this method.

Another recommended way is to write redirection information in a meta tag, in the head of the html document, add

<meta http-equiv="refresh" content="0;url=http://127.0.0.1:8000" />

This will also redirect the visitor to http://127.0.0.1:8000. It is better than using javascript for redirection since user's browser may disable javascript.

Upvotes: 1

Related Questions