Documentation > Settings > Security Settings > Prevent Direct Image Access on nginx

Prevent Direct Image Access on nginx

Note: “Prevent Direct Images Access” is available in picu Pro from version 2.5.0+.

If your server is running nginx, you need to add the following custom rule to your nginx config to fully prevent outside access of your images. The requests will get routed through picu, but the original file URLs would still remain accessible without this config.

Add to your nginx config

location ~* /wp-content/uploads/picu/ {
    deny all;
}Code language: Nginx (nginx)

Place this block before your general location / block. This will block direct access to all picu collection images at once, existing and new ones.

Note: The above assumes a standard WordPress installation. If your wp-content or uploads folder is in a custom location, adjust the path accordingly.

Managed hosting

If you are on a managed WordPress host (e.g. Kinsta, Cloudways, WP Engine) and don’t have direct access to your nginx configuration, contact your host’s support and ask them to add this rule for you.

Testing

After adding the rule, try opening a direct image URL from one of your collections in a new browser tab. You should see a 403 Forbidden error. If the image still loads, the rule is not yet active. Make sure to restart nginx for the config changes to load.

Need help?

If you couldn’t find what you were looking for and need more assistance, please get in touch with us directly and we’re happy to help.