X
X
ximtej2016-01-21 18:36:04
PHP
ximtej, 2016-01-21 18:36:04

How to allow access only to index.php in the root of the site?

The essence of the problem is as follows. It is necessary to forbid access to all *.php files on the server, except for the index.php file, which is located in the root directory only . The number of folders in the site root is unknown. It will not work to register .htaccess for each folder. Any ideas?

<Files *.php> 
  deny from all 
</Files>
<Files index.php> 
  allow from all 
</Files>

This option is not suitable: *.php files are not available, but index.php files are available in any folders

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-01-21
@BuriK666

<FilesMatch "/index\.php$">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question