Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I currently have a virtualhost within Apache that is using mod_cband and mod_rewrite. I am using mod_cband to limit the number of connections per remote user. When this limit is exceeded, it is supposed to return 503 Service Unavailable which is the mod_cband default.

If the limit is not exceeded then mod_rewrite should rewrite the URL according to the rules I have specified.

Unfortunately, mod_rewrite seems to take some sort of priority over mod_cband as the rewrite occurs even when the limit is exceeded and 503 Service Unavailable is never returned.

Is there anyway to force mod_cband to be applied before mod_rewrite? Config is as follows:

<VirtualHost *:80>

    CBandRemoteSpeed 1024 1 10

    RewriteEngine on
    # Some other rewrite rules.

    RewriteRule (.*) [R]


share|improve this question
up vote 3 down vote accepted

Move the mod_rewrite processing into a later phase by putting the rules in .htaccess instead.

share|improve this answer
Which .htaccess file should I put my catch all rule in so that it is used for every request? – DanielGibbs Jun 15 '12 at 23:16
The one right in DocumentRoot. – Ignacio Vazquez-Abrams Jun 16 '12 at 0:16
Worth noting: doing this in a <Directory> block works just as well, without the performance (and potentially security) issues inherent in .htaccess files. – Shane Madden Jun 17 '12 at 6:03

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.