Thursday, February 12, 2009

Redirecting URL Permanently in Apache

Step 1: Install apache if not installed;

You must have apache installed and running.

apt-get install apache2

Step 2: Just add following lines to /etc/apache2/sites-available/default file,
NameVirtualHost *

ServerName domainname.com
ServerAlias www.domainname.com
Redirect permanent / http://www.newdomainname.com/



Where 192.168.0.1 is IP of machine running apache2,
servername is name of machine
Alias can the other name of the machine.
Redirct permanent will redirect to the new domain.


Step 3: Restart the apache

/etc/init.d/apache2 restart

Step 4: Test the site

References
http://www.yolinux.com/TUTORIALS/ApacheRedirect.html

No comments: