I have a website that doesn\'t seem to redirect from non-www to www.
My Apache configuration is as follows:
RewriteEngine On
### re-direct t
This works for me:
RewriteCond %{HTTP_HOST} ^(?!www.domain.com).*$ [NC]
RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,L]
I use the look-ahead pattern (?!www.domain.com)
to exclude the www
subdomain when redirecting all domains to the www
subdomain in order to avoid an infinite redirect loop in Apache.