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
If using the above solution of two blocks with different ServerNames...
ServerName example.com
Redirect permanent / http://www.example.com/
ServerName www.example.com
... then you must set NameVirtualHost On as well.
If you don't do this, Apache doesn't allow itself to use the different ServerNames to distinguish the blocks, so you get this error message:
[warn] _default_ VirtualHost overlap on port 80, the first has precedence
...and either no redirection happens, or you have an infinite redirection loop, depending on which block you put first.