$HTTP_HOST multiple rewrite

Posted by nrivoli on Server Fault See other posts from Server Fault or by nrivoli
Published on 2013-10-22T02:43:03Z Indexed on 2013/10/22 3:56 UTC
Read the original article Hit count: 406

Filed under:

I have Apache 2.2, Ubuntu 12. I want to load a different envionment based on my HTTP_HOST, this works for the first domain only, after that I get error 500, " Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace."

and I am not able to see my error...

RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule  ^ - [F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d



RewriteCond %{HTTP_HOST} ^server-dev.domain.tld$ [NC]
RewriteRule ^(.*)$ /api/dev.php/$1 [L]

RewriteCond %{HTTP_HOST} ^server-qa.domain.tld$ [NC]
RewriteRule ^(.*)$ /api/qa.php/$1 [L]

#RewriteCond %{HTTP_HOST} ^localhost$ [NC]
#RewriteRule ^(.*)$ /api/localhost.php/$1 [L]

I am accesing to https://server-dev.domain.tl/api/whatever https://server-qa.domain.tl/api/whatever

© Server Fault or respective owner

Related posts about apache2