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 *

Redirect permanent /

Where 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


No comments: