Infinite loop in aliasdomain redirects
The RewriteCond regular expression for aliasdomain redirects has a bug. The following scenario (a real-life example on our server) causes a redirect loop: Main domain: zobozdravnik-skrbinc.si Alias domain: skrbinc.si
The redirect loop is caused by a bad regular expression in RewriteCond:
RewriteEngine on RewriteCond %{HTTP_HOST} skrbinc.si$ [NC] RewriteRule ^/(.*)$ http://zobozdravnik-skrbinc.si/$1 [R,L]
The problem is that the condition matches both the alias and the main domain, causing an infinite redirect loop.
I propose the following solution:
RewriteCond %{HTTP_HOST} (^|.)skrbinc.si$ [NC]
Maybe it can even be shortened to ^skrbinc.si$. I'm not sure whether subdomains should be matched or not. Probably not.