Re: 301 Moved permanently - how to?
by Andrew McFarland <aamcf(at)aamcf.co.uk>
|
Date: |
Mon, 07 Jan 2002 17:59:53 +0000 |
To: |
"'hwg-techniques(at)mail.hwg.org'" <hwg-techniques(at)mail.hwg.org> |
In-Reply-To: |
pdc |
|
todo: View
Thread,
Original
|
|
At 11:10 07/01/02 +0100, Klaas De Waele wrote:
>How do I set up a header so that this is achieved? I have access to
>.htaccess, php, perl cgi. If anyone could help me out on this, I'd be very
>grateful.
Easiest way is with .htaccess
If the structure of the sites (directories and filenames) are identical,
you can do it with one line:
Redirect permanent / http://www.example.com/
What this does is takes any URL that starts with a / and adds everything
after the slash to the new domain
For example, suppose your website is currently at
www.example.org/mysite/mysubdirectory/. If you put the above line in the
htaccess file in mydirectory then the url
http://www.example.org/mysite/mysubdirectory/myfile.html
will become
http://www.example.com/mysubdirectory/myfile.html
If the new site doesn't have the same structure, then you need to add
individual lines for the individual files as well.
For example, to redirect
http://www.example.org/mysite/file.html
to
http://www.example.com/anotherdirectory/file.html
you would put in the line
Redirect permanent
/file.html http://www.example.com/anotherdirectory/file.html
If you are using apache, or an apache compatible server, the relevant
documentation is at
http://httpd.apache.org/docs/mod/mod_alias.html
HTH,
Andrew
--
http://aamcf.co.uk/
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA