I attempted to set the privateTemplateTrigger to an empty string in my config/general.php file, because I don't ever want Craft to serve up a template file on its own just because a visitor happens to put in a URL that matches its name, and I was hoping to avoid prefixing every single file in my /templates directory with an underscore. Unfortunately doing so breaks several CP pages (like Globals and Plugins)...

I'm guessing it's because some CP files are relying on this feature? Surely there must be some way to disable this "direct rendering of template files" thing that doesn't break the CP?

  • Per our conversation in the comments on my answer, I reported this to P&T as a bug. Brad confirmed it as a bug, and said this... "Fixed for the next release! And it also enables the behavior that he's looking for as well." That being said, I'm gonna go ahead and close this thread as a "bug report". :)
    – Lindsey D
    Aug 5, 2015 at 19:28
  • 1
    Thanks. I don't know who you are but you are super helpful and I appreciate it!
    – Jordan Lev
    Aug 5, 2015 at 21:07

1 Answer 1


This is very, very simple to do... just put every single template into a specific folder, then prefix the folder with an underscore:


Template files beginning with underscores are hidden, similarly, template folders beginning with an underscore hide everything inside.

  • Yeah, but then aren't I prefixing every "include" with '/_everything/'? It just makes the code so ugly (and a big selling point of Craft to me was being able to keep the template markup nice and clean, and intuitive).
    – Jordan Lev
    Aug 4, 2015 at 20:52
  • 2
    Yes... but isn't that a small price to pay for being able to hide every single template? I (personally) don't think that it makes the code much uglier... and ultimately, the code is not what your customers are judging. :)
    – Lindsey D
    Aug 4, 2015 at 20:55
  • Yeah, but in this case we are the customers of CraftCMS, so couldn't the same argument be made that having a one-click option to not serve template files directly is a small price for P&T to pay? :) I know you're not P&T, so it's a rhetorical question (and I appreciate you taking the time to respond -- thanks).
    – Jordan Lev
    Aug 4, 2015 at 21:04
  • 1
    No problem. :) If you want to suggest a makeAllTemplatesPrivate config setting, I'd recommended posting that to feedback.buildwithcraft.com.
    – Lindsey D
    Aug 4, 2015 at 21:16
  • 1
    On a side note, I'm surprised that changing the privateTemplateTrigger value had any impact on the CP. That's probably worth reporting as a bug.
    – Lindsey D
    Aug 4, 2015 at 21:18

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