PDA

View Full Version : Best way to redirect?


Tomek
Sat 23rd Oct '04, 6:44am
Hi,

I'm looking for the best way to redirect some Domains to a Site.

Example situation:
- Forum is installed on http://www.maindomain.de/forum/
- if someone types the URL http://www.maindomain.de, he should be redirect to http://www.maindomain.de/forum/
- there are two other Domains domain1.de and domain2.de, that should be redirected to http://www.maindomain.de/forum/
- the redirections should be spider-friendly

At the moment I'm doing all this with html and meta refresh:
<meta http-equiv="refresh" content="0; URL=http://www.maindomain.de/forum/" />

There is propably a better way to do this, perhaps with mod_rewrite. But I don't know how.

Thanks for any assistance.

Tomek
Sat 23rd Oct '04, 7:56am
I've solved it. :)

<VirtualHost 199.199.199.199:80>
ServerName www.maindomain.de
ServerAlias www.domain1.de domain1.de www.domain2.de domain2.de
[...]
RewriteEngine on
RewriteRule ^/$ http://www.maindomain.de/vb/ [R]
RewriteRule ^/forum/.* http://www.maindomain.de/vb/ [R]
</VirtualHost>

splooge
Sat 23rd Oct '04, 3:32pm
How I do it with php:


<?php
header( "Location: http://www.somewhereelse.com/" );
?>