Is it possible to do this thing? I'm trying to deny all and allow localhost in /location in nginx config but this does not work.

This is struct my files:

  • index.php
  • templates/__NEW/ (here are files like index.html)

If user write in address bar link-to-site.com/templates/__NEW/, user see content of index.html which contain twig variables. I want to block access via addres bar, but index.php sholud render file index.html in templates, any images, css, etc. If i block access to this location, from web isn't possible to get images or other files.

Is it possible? Secure this location from access wia bar address, not block for script rendering this file.


The best way is to move templates and static assets into separate sub-directories and deny access to template sub-directory while allowing access to static assets sub-directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.