Redirect domain to www

Domain redirection

Setting a domain to always be the same value helps with SEO, statistical analysis and keeps the website a little cleaner. This website has a redirect rule that only allows one domain. My redirection statements redirect the domain to www.

Domains can be typed with www at the beginning and also an extra . (full stop) at the end. This allows up to 4 domains:

#all working domains that apache allows http://marcwatts.com.au http://marcwatts.com.au. http://www.marcwatts.com.au http://www.marcwatts.com.au.

If you have setup apache with virtual hosts and your website is the first on the list, it may also become the default website. What this means is that even requests that come through in which a domain has not been set, your default website may be used instead. This should also be avoided. In the end what you want is one domain name and for everyone to see that one domain. The below code will redirect your domain to www.

### redirect to www if on live site ### RewriteCond %{HTTP_HOST} ^marcwatts\.com\.au$ [NC,OR] RewriteCond %{HTTP_HOST} ^marcwatts\.com\.au\.$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\.marcwatts\.com\.au\.$ [NC] RewriteRule ^(.*)$ http://www.marcwatts.com.au/$1 [R=301,L]