Exclude subdomain from processing

Oct 27, 2009 at 7:26 PM

I am trying to exclude a particular subdomain from rewrite rules.

The following code catches our mail server url in expresso:


The rest of the sites are processing correctly with the following condition:

RewriteCond %{HTTP_HOST}    ^(?!http://mail\.)  [I]

But the mail server throws a 404 error when the next rule is not commented out:

RewriteRule ^/(?!index.cfm)(?!.*\.js$)(?!.*\.xml$)(?!.*\.css$)(?!.*\.jpg$)(?!.*\.gif$)(?!.*\.png$)(?!.*\.swf$)(.*)$        /index.cfm/$1

I thought that the RewriteCond would make IIRF ignore the rest of the rules when it was true.

I have gone through all of the domain exclusion examples in the help file and can't figure out what I'm missing here.

Oct 27, 2009 at 8:55 PM

I dont think the value of HTTP_HOST includes the scheme.  It includes the host only.  In other words, mail.domain.com, not http://mail.domain.com .

So, the RewriteCond is evaluating to TRUE, even when requests are going to the mail server. Remove the http://  from that pattern, and it should work better.


Oct 27, 2009 at 9:48 PM

Wow. That was too easy (except for me). Thanks for the help.