• Techblog369, India
  • September 29, 2022

How to create PHP QR code and Save it to Database?

Hi In this Article I am going to show how to create QR code and save it to database also fetch QR Code in a Table Create a Page addqrcode.php in …

How to Send Multiple Files Attachment Mail using Laravel

Hi in this article i am going to show how to send multiple files attachment mail in Laravel. It’s simple example of Laravel send multiple attachment in mail. I explained simply …

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

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

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

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



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

Leave a Reply

Your email address will not be published.