G
G
gregorypetrov2018-07-24 15:08:12
linux
gregorypetrov, 2018-07-24 15:08:12

How to deny access to a file with a specific name regardless of the folder?

Let's say the site root /var/www/mysite contains subfolders.
What rule should be written in .htaccess to deny access to the myscript.php file, no matter what subfolder it is in?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2018-07-24
@Adamos

RewriteRule ^.*/myscript\.php$ /404.php [L]

W
wisgest, 2019-03-06
@wisgest

<Files myscript.php>
Redirect 404 /
</Files>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question