Redirect domain.com to www.domain.com

By | 8 August, 2012

This is step to redirect domain.com to www.domain.com for Ubuntu and Apache2 environment :

Requirement

1) enable mod vhost alias

a2enmod vhost_alias

2) reconfigure virtual host

<VirtualHost 10.9.192.212>
ServerName domain.com
ServerAlias domain.com
ServerAdmin web@test.my

Redirect / http://www.domain.com/
</VirtualHost>

<VirtualHost 10.9.192.212>
ServerName www.domain.com
DocumentRoot /home/domain.com/www
</VirtualHost>

3) Restart the apache’s services

 

Then you will success to redirect domain.com to www.domain.com

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.