HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   set up 301 redirect from old website to new website (http://www.howtoforge.com/forums/showthread.php?t=15681)

showe1966 21st September 2007 21:27

set up 301 redirect from old website to new website
 
I've just spent a very enjoyable 2 hours working out how to do the following.
What I needed to do was redirect all the traffic from my old website to my new website.

I am running ubuntu 7.04, apache 2.

Here is what you need to do:-

1. vi /etc/apache2/sites-enabled/000-default

2. Change the word "none" to "all in the following line:

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All

3. Add the following code at the bottom of the file:

RewriteEngine ON
RewriteRule /.* http://www.siteyouwanttoredirectto.com/ [R=301,L]

falko 22nd September 2007 12:30

This link might also be interesting: http://www.stevenhargrove.com/redirect-web-pages/


All times are GMT +2. The time now is 22:07.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.