Eric Covener wrote:
On Thu, May 14, 2009 at 6:57 AM, André Warnier <aw@xxxxxxxxxx> wrote:For example, would the following work, or am I forgetting something, doing something bad, risk security bypasses, etc.. ? RewriteCond %{HTTP_HOST} app3.company.com RewriteRule ^/$ /app3/ [L] RewriteCond %{HTTP_HOST} app3.company.com RewriteRule ^/app3/.+$ - [L] RewriteCond %{HTTP_HOST} app3.company.com #RewriteRule ^/app1/.+$ - [F] #RewriteRule ^/app2/.+$ - [F]
RewriteRule ^/(app1|app2)/ - [F]
Yes it is my intention to apply each RewriteCond to the 5 following RewriteRule lines. I gather that doesn't work ? Do I have to repeat that RewriteCond once per RewriteRule then (as now modified above), or is there a smarter way of doing that ?RewriteRule ^/(.+)$ /app3/$1 [L]Your conditions only apply to the immediately following rule, but it seems like your intent is to have them applied to all of them.
I think that my less-regexp-inclined colleagues would consider that more as gratuitious show-off obfuscation on my part however.You might simplify by capturing the "app3" on the HTTP_HOST and using it on the subsequent conditions/rules for ease of maintainability.
;-) Or do you mean something like : # catch all 3 at once RewriteCond %{HTTP_HOST} ^(app1|app2|app3).company.com$ RewriteRule ^/$ /%1/ [L] RewriteCond %{HTTP_HOST} ^(app1|app2|app3).company.com$ RewriteRule ^/%1/.+$ - [L] ... RewriteCond %{HTTP_HOST} ^(app1|app2|app3).company.com$ RewriteRule ^/(.+)$ /%1/$1 [L] I don't know how to manage the "forbidden" ones that way though. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx