Re: O.T. - Redirecton
| From: | Lars Torben Wilson | Date: | Sun, 10 Sep 2000 22:36:46 +0000 |
| Subject: | Re: O.T. - Redirecton | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16087@lists.php.net to get a copy of this message | ||
Jack Lauman writes:
> I need to redirect all requests from 2 older sites to the home page
> of the new replacement site.
>
> There are hundreds of links on search engines pointing to the older
> sites and I need them to refer to the new one.
>
> Can I do this with php or is there a way to modify httpd.conf to do it?
>
> Thanks,
>
> Jack
I have found Apache's mod_rewrite to be a good way to deal with
this. I had a website on my ISP's server, but later got a domain name
on a new host. I use the following in the original site's .htaccess to
redirect all requests for files to the corresponding file on the new
server:
RewriteEngine on
RewriteBase /
RewriteRule bandname[/]?(.*) http://www.bandname.com/$1
[R,L]
For instance, if the user requests a file from the old server,
i.e. http://www.oldserver.com/~torben/bandname/recordings.html,
they
will be automatically redirected to http://www.bandname.com/recordings.html.
Note--I wrote this sort of in a hurry months ago, so there may be
better ways to do it. There is a whole page dedicated to writing
redirects using this module at:
http://www.engelschall.com/pw/apache/rewriteguide/
Hope this helps,
Torben
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+