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

<pre><code>/craft/templates/_everything/
</code></pre>

<p>Template files beginning with underscores are hidden, similarly, template <strong>folders</strong> beginning with an underscore hide <strong>everything inside</strong>.</p>

CC BY-SA 3.0
2015-08-04T20:52:49.153Z
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
CC BY-SA 3.0
2015-08-04T20:55:34.730Z
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
CC BY-SA 3.0
2015-08-04T21:04:22.933Z
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
CC BY-SA 3.0
2015-08-04T21:16:41.177Z
No problem. :)  If you want to suggest a `makeAllTemplatesPrivate` config setting, I'd recommended posting that to [feedback.buildwithcraft.com](http://feedback.buildwithcraft.com/).
Lindsey D
CC BY-SA 3.0
2015-08-04T21:18:30.700Z
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
CC BY-SA 3.0
2015-08-04T20:39:39.043Z
2015-08-04T20:39:39.043Z
Lindsey D
<p>I attempted to set the <a href="http://buildwithcraft.com/docs/config-settings#privateTemplateTrigger" rel="nofollow"><code>privateTemplateTrigger</code></a> to an empty string in my config/general.php file, because I don't <em>ever</em> 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)...</p>

<p>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?</p>

CC BY-SA 3.0
2015-08-05T19:28:35.730Z
Per our conversation in the [comments on my answer](http://craftcms.stackexchange.com/a/10852/45), 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
CC BY-SA 3.0
2015-08-05T21:07:10.957Z
Thanks. I don't know who you are but you are super helpful and I appreciate it!
Jordan Lev
<control-panel><routing>
Prevent ALL templates from being rendered directly?
# Prevent ALL templates from being rendered directly?

(Asked by: username_0 on 2015-08-04)

I attempted to set the [`privateTemplateTrigger`](http://buildwithcraft.com/docs/config-settings#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?

**Tags:** control-panel, routing

> **Comments:**
> **username_1**: Per our conversation in the [comments on my answer](http://craftcms.stackexchange.com/a/10852/45), 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". :)  
> **username_0**: Thanks. I don't know who you are but you are super helpful and I appreciate it!  

---

## 1 answers

### Answer by username_1 on 2015-08-04. Score: 6

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

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

> **Comments:**
> **username_0**: 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).  
> **username_1**: 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. :)  
> **username_0**: 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).  
> **username_1**: No problem. :)  If you want to suggest a `makeAllTemplatesPrivate` config setting, I'd recommended posting that to [feedback.buildwithcraft.com](http://feedback.buildwithcraft.com/).  
> **username_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.  

---

