Deny folder and all the subfolders in Apache with .Htaccess

No Comments

You have a folder inside which there are library files which you don’t want to show it to the end-users.

RewriteRule ^subfolder/ - [R=404,L,NC]

You can send any type of HTTP status code with this. If you want to show a Forbidden error you can show R=403.

L tells that this is the last rule and discard any rule after this.

NC is used for Case Insensitive.

Leave a Reply

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