Hi all,
I am trying to set a redirect rule in my Apache config so that any request coming to
http://example.com will be permanently redirected to
http://www.example.com
However, when I follow these instructions:
http://httpd.apache.org/docs/2.3/rew...#canonicalhost
http://wiki.apache.org/httpd/CanonicalHostNames
I get a warning when restarting httpd
Code:
[warn] _default_ VirtualHost overlap on port 80, the first has precedence
and when trying to access
http://example.com or
http://www.example.com I get -
Error 310 There were too many redirects.
Any suggestions? what am I missing?
(BTW, I'm trying to avoid using mod_rewrite for this if possible)
Here are the relevant httpd.conf settings
Code:
ServerName www.example.com
UseCanonicalName Off
<VirtualHost *:80>
ServerName example.com
Redirect permanent / http://www.example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.com
ServerAlias sub1.example.com
ServerAlias sub2.example.com
ServerAlias sub3.example.com
ServerAlias sub4.example.com
DocumentRoot /somewhere/over/the/rainbow
SetEnv FOO "bar"
FileETag All
ExpiresActive On
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
<Directory "/somewhere/over/the/rainbow">
Options FollowSymlinks
AllowOverride All
Order allow,deny
Allow From all
</Directory>
</VirtualHost>
Thanks,
karnaf