Forum Moderators: phranque

Message Too Old, No Replies

Early exit commands in htaccess?

         

Umbra

4:56 pm on Nov 8, 2004 (gmt 0)

10+ Year Member



Let's say you say that you have a "close to perfect htaccess ban list". The problem is that it doesn't seem efficient that every single HTTP request has to be processed through your ban list (for example, small graphics or certain directories). Does Htaccess have the equivalent of a stop or exit command?

For example:

# Exit now if small graphic:
RewriteCond %{REQUEST_URI} /smallgraphics/.+\.gif
RewriteRule <DO NOTHING> [L]
# Begin Ban List

I apologize if this question has already come up before on previous threads.

jdMorgan

5:50 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The RewriteRule syntax supports this directly.

Be very aware of exactly what rules you bypass by inserting this code, since anything after this rule will be skipped if "smallgraphics" are requested:


# Exit now if small graphic:
RewriteRule ^smallgraphics/.+\.gif$ - [L]
# Begin Ban List

Refer to the mod_rewrite documentation (cited in our charter) for more information.

Jim

Umbra

12:13 pm on Nov 9, 2004 (gmt 0)

10+ Year Member



Great! Thank you!