I'm trying to force users on my site to use the www version, however my configuration is causing an infinite redirect loop. The relevant configuration is below:
<VirtualHost *:80> ServerName www.mydomain.com DirectoryIndex index.html index.php DocumentRoot /home/me/sites/mydomain.com/htdocs # Log file locations LogLevel warn ErrorLog /home/me/sites/mydomain.com/logs/error.log CustomLog /home/me/sites/mydomain.com/logs/access.log combined </VirtualHost> <VirtualHost *:80> ServerName mydomain.com RedirectMatch permanent ^/(.*) http://www.mydomain.com/$1 </VirtualHost>
This method is the way I've found to be the most acceptable from answers on Stack Overflow.
However, when browsing to
mydomain.com the following happens:
As you can see, it's bouncing me between www and non-www until the browser quits.
I've verified that it's not a .htaccess issue by completely removing it from my document root, yet it still happens.