I have a template group that I am using to store embeds like header and footer. I do not want people to be able to directly access those templates by going to www.domain.com/embeds/header. I want that to redirect to the 404 page. How do I go about this? Is there a way to block template groups from direct access? Would this be better done in .htaccess? Thanks for any help.
1 Answer
In versions of EE2 prior to 2.9 if you start the template name with a dot it will not be directly accessible.
In the just-released EE 2.9 you can specify a different character instead of dot and the default has been changed to underscore.
Documentation on this feature (currently describes 2.9 handling):
http://ellislab.com/expressionengine/user-guide/templates/hidden_templates.html
I don't believe EE has a mechanism for blocking direct access on the template-group level. If you needed that then you would probably want to do on the server level (.htaccess rewrites).
-
I ended up using Stash and a template to get around this. I researched your suggestion and it seems to be the answer to what I was asking. I appreciate your time.– user3734990Jul 18, 2014 at 21:22
-
If you want to block access on the group level just setup
embeds/index
with a{redirect="404"}
.– IngmarDec 2, 2015 at 8:19