So the usual canonical redirect example is:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
I can’t work out how to make it more generic, so i don’t have to specify example.com, it will do it for the domain in question. The reason for this is to flip between development mode on my local machine, and to avoid having to change it every time i build a new site!
Thanks.
I think something like this will work:
Which basically just says “if it doesn’t start with ‘www’, put ‘www’ in front and redirect.”