Topics

301 redirection on apache server

This is how to a simple 301 redirection, it is better to use htaccess for this, create a text file, name it '.htaccess' without the quotes, place the file in your root folder and add the following line to it:

redirect 301 /oldpage.htm http://www.domain.com/newpage
replace oldpage.htm with your old page name and domain.com with your domain

This can be used to add the www to the url if not enetered by the client

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

How to add web sites to Apache server?

Adding new websites to apache server is a straight forward process, find your httpd.conf file, this will be in the instalation folder of Apache, in my case "C:\Program Files\Apache Software Foundation\Apache2.2\conf",
open the file with with a text editor and add the following, replace DocumentRoot with the path of the web site targeted:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/siteName1"
ServerName siteName1.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/siteName2"
ServerName siteName2.com

</VirtualHost> 
A complete reference of the hosting options you have can be founf here in Apache web site:
http://httpd.apache.org/docs/2.0/vhosts/examples.html

Eanjoy