Quote:
Originally Posted by Skinner 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]