How can I block access to a dirrectory/file in my WordPress project, .adding an htaccess file didn’t work

[ad_1]

Hello,

I have a .zip file in one of my plugin directories that I want to make sure is publicly inaccessible, for example if I have the file located at *wp-content/plugins/my-plugin/my-plugin.zip*, if someone were to figure out the URL they could download the .zip file which is what I want to prevent

I am unable to use a plugin to accomplish this (Job is very restrictive on adding new plugins), and I thought I had the perfect solution by using an .htaccess file to accomplish this. I added the .htaccess file to the plugin directory the .zip file is located in, but when I add the following code to the .htaccess file the .zip is still downloadable, from the guides I have been following it should throw a 403 status code when the URL is visited instead of allowing the file to be downloaded

<Files “my-plugin.zip”>
deny from all
</Files>

Just wanted to see if anyone had any thoughts on alternative solutions or why my .htaccess file is not preventing access properly?

[ad_2]
3 Comments
  1. Can you password protect the parent folder? I know you can do that in Apache to deny access to files in the folder

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer