Writing a mod security rule to block access to a PHP file

1.3k views Asked by At

I wish to block access to any file with name "modules.php" in any website. I have written a Rule in mod security but I'm not sure if it is working or not? here is the rule

SecRule REQUEST_LINE "@rx modules.php" \
"phase:2,block,severity:2,msg:'Blocking access to modules.php files.'"

Is that correct?

1

There are 1 answers

0
Wei On

It will work. Instead REQUEST_LINE to REQUEST_FILE for better performance.