WooCommerce Prevent Directory Indexing Not Working
-
Hi,
I’m setting up Woocommerce for my site. I intend to sell downloadable products, so I’m trying to set up X-Accel-Redirect/X-Sendfile method.
Per the article at https://woocommerce.com/document/digital-downloadable-product-handling/#protecting-your-uploads-directory:
– I confirmed with my host provider that they use/support NGINX Servers
– I selected it as my download method on the Woocommerce > Settings > Products > Downloadable Products page
– I added the code/configuration to the .htaccess file to protect your wp-content/uploads/woocommerce_uploadsThe problem is, on my Installed Plugins page, the following message won’t go away: “Your store’s uploads directory is browsable via the web. We strongly recommend configuring your web server to prevent directory indexing.”
To try and resolve it:
– I cleared my cache. Didn’t work.
– Based on another thread, I turned off (#) the one line that was originally in the htaccess file: #deny from all. Didn’t work.
– In the same thread, the person added lines about ‘file match’ and his set up began to work, so the file now reads as:# Protect WooCommerce upload folder from being accessed directly.
# You may want to change this config if you are using “X-Accel-Redirect/X-Sendfile” or “Force Downloads” method for downloadable products.
# Place this config towards the end of “server” block in NGINX configuration.
location ~* /wp-content/uploads/woocommerce_uploads/ {
if ( $upstream_http_x_accel_redirect = “” ) {
return 403;
}
internal;
}
<FilesMatch “\.(mov|mp3|jpg|pdf|mp4|avi|wmv)$”>
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
#deny from all`…still doesn’t work. The message still appears.
What am I doing wrong?
Thanks in advance.
- The topic ‘WooCommerce Prevent Directory Indexing Not Working’ is closed to new replies.