Wolfgang Adamec
Wolfgang Adamec

Reputation: 8524

How to block unwanted php requests in apache

Our web application needs no php code and our apache has no php installed,
but there are annoying php requests from different unwanted sources all the time.

How can I configure apache to ignore them, that those requests don't spoil the apache error log.

As we have unrestricted access to the server, we do not need an htaccess file.

Thanks alot in advance

Upvotes: 2

Views: 1994

Answers (2)

Daniel Ferradal
Daniel Ferradal

Reputation: 2900

Aside from the previous answer to forbid all php requests, you can also not log them with:

SetEnvIf Request_URI "\.php.*?" no_log
CustomLog /path/to/vh-access.log common env=!no_log

Upvotes: 2

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

You can try this in your httpd.conf in your section where mod_rewrite is mentioned

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule \.php.* - [F,L]
</IfModule>

Upvotes: 2

Related Questions