Nginx Folder Protection Issue

OptimizeCheckouts adds an .htaccess file to it’s protected directory to prevent public access. However, NGINX does not support .htaccess files. This means that you will need to update your NGINX server configuration to prevent public access to files in that directory.

What follows is an example of what you might add to your NGINX configuration, however we highly recommend contacting your web hosting company for assistance with making this change as each hosting environment is different.

location /wp-content/uploads/optimizecheckouts {
deny all;
return 403;

For Sites Hosted on (accounts that do NOT use cPanel).

Siteground has a custom server configuration that is not actually a true NGINX setup, but one of their cache settings called "NGINX Direct Delivery" will serve cached files directly through NGINX.

The code above will NOT work on Siteground. 

To solve the download folder protection on Siteground, we were advised by Siteground Support to disable the NGINX Direct Delivery option with the following steps:

  • When you are logged into your Siteground Account, you'll need to click on Site Tools.
  • Then go to "Speed > Caching"
  • Then click on "NGINX Direct Delivery" at the top, and turn off the service for the sites that you want to use the downloads folder.
  • Note: You will need to purge the cache on your site in order for this change to take effect.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.