• Techblog369, India
  • June 8, 2023

How To Configure A Sendinblue SMTP Relay in Postfix?

Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …

Create a simple password strength indicator with JavaScript

You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …

In this short instructional exercise we will cover a htaccess deny admittance to document augmentation. we should examine about htaccess limit admittance to document augmentation. This article will give you straightforward illustration of htaccess deny admittance to php records in transfers organizer. bit by bit make sense of forestall direct admittance to php document htaccess. You simply need to a stage to done htaccess cripple document expansion access.

  • Deny Access to .htaccess itself

# Deny access to .htaccess
<Files .htaccess>
Order allow,deny
Deny from all
</Files>

To conceal every one of the substance of the catalog without illegal message, utilize the IndexIgnore order essentially.

# Hide the contents of directories
IndexIgnore *

 

To hide some filetypes only, use

# Hide files of type .png, .zip, .jpg, .gif and .doc from listing
IndexIgnore *.png *.zip *.jpg *.gif *.doc

3. Prevent access to certain files

Even if you remove directories and files from listing, they are still accessible if you type the path.

To remove unauthorized access to certain file extensions, use

# Deny access to files with extensions .jpg, .psd, .log, .sh,jpg
<FilesMatch "\.(?:inc|jpg|jpeg|rb)$">
Order allow,deny
Deny from all
</FilesMatch>

# Deny access to filenames starting with dot(.)
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>

You may also password protect files and directories and store the passwords in a .htpasswd file.

# Password protect files
<FilesMatch "^(execute|index|myfile|anotherfile)*$">
AuthType Basic
AuthName "Mypassword"
AuthUserFile <Full Server Path to .htpasswd file>/.htpasswd
Require valid-user
</FilesMatch>

Author

nw.ippm@gmail.com

One thought on “How to deny direct access to folder and file?

Leave a Reply

Your email address will not be published. Required fields are marked *