# Nginx .htaccess equivalent to protect uploads directories

**URL:** https://discourse.roots.io/t/nginx-htaccess-equivalent-to-protect-uploads-directories/9502
**Category:** trellis
**Tags:** nginx
**Created:** 2017-04-30T14:55:09Z
**Posts:** 8
**Showing post:** 5 of 8

## Post 5 by @fullyint — 2017-04-30T17:36:28Z

There may be a smart technique with just Nginx. I haven’t looked.

However, you could perhaps reuse a single [child template](https://roots.io/trellis/docs/nginx-includes/#child-templates) across projects, given that a child template would make available a variable like `site_hosts_canonical | first`  
(or maybe you’d want to loop over all `site_hosts_canonical`).

[This thread](https://discourse.roots.io/t/help-dynamically-generating-csp-nginx-include/8967/2) discusses why different variables are available in in the child template context vs the regular nginx include context.

---

_[View the full topic](https://discourse.roots.io/t/nginx-htaccess-equivalent-to-protect-uploads-directories/9502)._
