Forum Moderators: phranque

Message Too Old, No Replies

Combine rewrite rules

Will this work?

         

grandma genie

9:26 pm on Mar 22, 2011 (gmt 0)

10+ Year Member



Hello,

I want to add a new rewrite rule to my htaccess file and think I can combine it with a rule that is there now. Here are the two rules:

#
# Ban attempted cpath=<URL> OS Commerce exploit
RewriteCond %{QUERY_STRING} cPath=https?:// [NC]
RewriteRule ^ - [F]
#
RewriteCond %{REQUEST_URI} \.php/login\.php [OR]
RewriteCond %{QUERY_STRING} \.php/login\.php
RewriteRule .* - [F]
#

Can I combine these to this:

#
# Ban attempted hack attempts in OS Commerce
RewriteCond %{REQUEST_URI} \.php/login\.php [NC,OR]
RewriteCond %{QUERY_STRING} \.php/login\.php [NC,OR]
RewriteCond %{QUERY_STRING} cPath=https?:// [NC]
RewriteRule ^ - [F]
#

These combinations of terms to do not occur except in a hack attempt. Is this worded correctly?

Thank you.

Grandma_genie

g1smd

10:24 pm on Mar 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The proper way to test this is to request each thing you want to block and use the Live HTTP Headers extension for Firefox to check the server returns the correct responses.