Can anyone help me with this:
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.$1 [R=301,L]
What I am trying to do is create a rewrite rule that sends you to the www version of a site if you try to connect using the non www version.
The condition works but the rules doesn’t, it sends me to http://
Can anyone suggest hoe I can fix this.
I was expecting $1 = everything in the condition above between ^ and $
Thanks
Don’t use
HTTP_HOST, it’s evil.Do this:
Where
%1matches the grouping from a previousRewriteCond.