K
K
kr_ilya2020-03-08 18:06:41
htaccess
kr_ilya, 2020-03-08 18:06:41

How to deny access to a directory other than a specific one?

The proxy folder contains a browse.php file and a few other files.
It is necessary that the user can go to site.ru/proxy/browse.php.
BUT deny access to other directories, for example:
site.ru/proxy
site.ru/proxy/admin
site.ru/proxy/plugins/live.com.php
etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dolosweb, 2020-03-08
@Dolosweb

Here is the solution to
not use the deny from prohibition, but only the redirection of
all folders will become forbidden, so that for example / css folders should be left in the .htaccess folder
and set RewriteEngine off in it - the entire folder is available
RewriteRule ^(.*)$ index.php [L ] // redirects all requests to the index
RewriteRule ^([^.]+)$ /proxy/browse.php [L] // disable specific file redirection (i.e. allow access as a separate file)

D
dodo512, 2020-03-09
@dodo512

FILE /proxy/.htaccess
RewriteRule !^browse\.php$ - [F]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question