The site has a text file site.com/php/contacts.txt . If you open this file in a browser, then the entire text of the file is visible. How to close access to the file so that you can view it only on the server, but not through a browser?
2 answers
Using the .htaccess file, you can do this as follows:
RewriteEngine On RewriteBase / RewriteRule ^php/contacts.txt$ - [R=404,L] - Does this option work only if the PHP folder is in the root? - Frontender
- This one - yes. Only if the folder is at the root. - user194374
- onemore confusing way: place the file above the root. to do this, you may have to edit the code (if the code somehow contacts this file). - root_x Povierennyy
- RewriteRule ^ page / php / contacts.txt $ - [R = 404, L] ??? - root_x Povierennyy
- For some reason, victorpavloff.tmweb.ru/php/contacts.txt does not work for me even at the root - Frontender
|
Using the .htaccess file, you can do this as follows (Version 2):
<Files php/contacts.txt> Deny from all </Files> |