Web Hosting Talk







View Full Version : Best Way to Redirect...


NVB
08-30-2001, 04:40 PM
I would like to redirect any hits on a message board to a different server, with a different domain name. Hits to other portions of the site should remain on the original server. The hits that should be redirected would be in the form messageboard.cgi , messageboard.cgi?az=list , messageboard.cgi?az=show_thread&omm=2&omm=23 , ... or messageboard/forum1/112.html

I am thinking about adding a Javascript statement or Meta tag to the top of each page in a template file. I could write to all the html pages at once through admin commands and I could update the cgi pages dynamically.

What would be the best Javascript command or Meta tag for this type of redirect?

Does anyone know a better or an alternative way to do this?

Is there any type of server level directory redirect for that would be more efficient and faster than the javascript?

Chicken
08-30-2001, 06:42 PM
I'd stick to server redirection and rewrites personally...

Someting like:

Redirect /this.file http://www.domain.com/someplace

Explained fully:
http://httpd.apache.org/docs/misc/howto.html
http://www.apache.org/docs-2.0/misc/rewriteguide.html

Web Master 2
09-03-2001, 11:42 PM
Set your apacgge cfg by adding the following inside the <VIRTUALHOST> section


RewriteEngine on
RewriteRule ^/messageboard.cgi(.*) http://newhost/messageboard.cgi$1 [R]

Note, this is an external redirect, carried out by the browser, so it won't work if the request is POST. To solve this problem, you can turn on mod_proxy and change [R] to [P]. This way of using proxy is very convenient when you are moving DNS, if people are taken to your old IP, then they will be proxyed to the new one, when the DNS propagation is done, they are at the new IP, they don't experience any difference during the transfer process.

valkaryn
09-04-2001, 01:58 PM
If its all under the same directory, you don't have to get fancy and load extra apache modules unnecessarily. You can just use the Redirect directive:


Redirect /virtpath/to/wwwboard/ http://www.newsite.com/board/


Place this directive in your apache configuration file.