A
A
AlexWinner2010-09-21 10:47:40
PHP
AlexWinner, 2010-09-21 10:47:40

Disable php script execution for Apache virtual host subdirectories

Please tell me what to write in the Apache config so that php scripts are not executed in certain directories of the virtual host. PHP is enabled via mod_php5.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
N
Nikolai Vasilchuk, 2010-09-21
@AlexWinner

Then try to write in .htaccess

M
mrBuG, 2010-09-21
@mrBuG

habrahabr.ru/blogs/php/61842/
Here it is described and there are sensible comments

N
Nikolai Vasilchuk, 2010-09-21
@Anonym

The first thing that comes to mind is .htaccess to a directory with something like this
<FilesMatch ".(php) $">
Order Allow,Deny
Deny from all
</FilesMatch>

M
Mikhail Nosov, 2010-09-21
@Mihalich88

RemoveHandler .php
AddType text/html .php

E
Eugene, 2010-09-21
@Nc_Soft

Everything above is correct, only there is one point: If there is another .htaccess in the internal directory, but it will override the external one, be careful with this.

H
HellWalk, 2019-05-30
@HellWalk

Option for nginx, for the images folder and everything in it:

location ~* ^/(images)/.+\.(php|php3|php4|php5|phtml|phps|pl|pm)$ {
        deny all;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question