View Single Post
Old 17-06-2009, 02:45:04 PM     #5 (permalink)
squarerobot
Member
 
squarerobot's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 64
squarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond reputesquarerobot has a reputation beyond repute

Quote:
Originally Posted by Skinner View Post
Use htaccess settings to set preference
For those of you that don't know, this is the code to use to make the non www version of your site redirect to the version with the www. Simply add the following to your .htaccess file and hey presto!

Code:
# 301 redirect non-www. to www.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.co.uk [NC] 
RewriteRule ^(.*)$ http://www.yourdomain.co.uk/$1 [L,R=301]
I also use the following to redirect any requests for index.php to just mydomain.co.uk - this helps prevent both being indexed (better for SEO imho).

Code:
# 301 index.php to /
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [L,R=301]

Last edited by squarerobot; 17-06-2009 at 02:54:41 PM. Reason: fixed the missing bracket
squarerobot is offline