Solved

Apache working with conditions

Posted on 2010-09-10
1
219 Views
Last Modified: 2012-05-10
hi!

i've got a little problem, trying touse different rewrite rules files from inside virtual host directive.

My virtual host is listening at *:80, and ServerName is aa.lalala.com. Alternatively, i've got several ServerAlias like bb.lalala.com and cc.lalala.com. I need some way to load every rewrite rules file for every subdomain and i'm thinking if there exists any kind of "if" directive in apache to load a rewrite file based on host.

For ex.: if arrives a request for aa.lalala.com use rewrite_rules_aaa.txt, if request id for bb.lalala.com use another one, etc.

Any way for doing this exists? I've seen SetEnvIf Directive, but i'm not ensure if this is i'm looking for.

Thanks in advance!
0
Comment
Question by:morsa804tons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 26

Accepted Solution

by:
arober11 earned 500 total points
ID: 33648964
Yes, can think of a couple be the easiest is probably using mod_rewrite itself, and the SKIP [S] directive e.g.

# If NOT host aa.lalala.com, skip the next 20 rewrite rules.
RewriteCond %{HTTP_HOST}   !^aa.lalala.com$  [NC]
RewriteRule  .*  -  [S=20]

RewriteRule  .....


# If NOT host bb.lalala.com, skip the next 11 rewrite rules.
RewriteCond %{HTTP_HOST}   !^bb.lalala.com$  [NC]
RewriteRule  .*  -  [S=11]


RewriteRule  .....

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question