Solved

Apache working with conditions

Posted on 2010-09-10
1
212 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
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now