Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now my rewrite rule forwards all subdomains except chat.auricle.fm to the root:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*\.auricle\.fm [NC]
RewriteRule ^(.*)$ http://auricle.fm/$1 [L,R=301]

How can I change it so that it forwards all subdomains except for chat.auricle.fm?

share|improve this question

I've almost never done any apache configuration, but it took me 2 minutes to find this:

By default successive RewriteCond directives are linked by a logical AND. There is an optional modifier, [OR], that allows you to chain the next RewriteCond with a logical OR.

This should do the trick:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*\.auricle\.fm [NC]
RewriteCond %{HTTP_HOST} !=chat.auricle.fm [NC]
RewriteRule ^(.*)$ http://auricle.fm/$1 [L,R=301]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.