Restrict access to upload folders

To restrict accessing / executing php or other scripts from uploads or other restricted folders, use the below mentioned code in .htaccess file put in that upload folder.

# Only the following file extensions are allowed (jpg,jpeg,php,gif,pdf,gz)
Order Allow,Deny
Deny from all
<FilesMatch "\.([Jj][Pp][Ee]?[Gg]?|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Gg][Zz]|[Pp][Dd][Ff])$">
Allow from all

This will restrict the excution/access of files uploaded by any hacker.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Time Zone Settings

Create / Edit  .htaccess file in the public_html folder and Add the following line to set the...

How to deploy laravel project in linux shared hosting

Laravel is not designed for shared hosting providers. If you can afford a bit more, we suggest to...