First Craft install so please excuse me if this is a newbie Q.

Templates are in /craft/templates. Is it possible to move those to a different location? Our other sites (EE) have templates stored with the UI theme source files so everything to do with the the site look and feel is in one place.



The default template path can be changed by setting the CRAFT_TEMPLATES_PATH PHP constant in your index.php file:

define('CRAFT_TEMPLATES_PATH', "path/to/templates");

I would recommend, however, that you start with the default path locations, until you are more comfortable with the app. There is a logical system in place which works really well once you get used to it. And you'll notice that the craft app folder (and all the plug-ins) are organized the same way, so once you start building your own sites and plugins it will all feel very integrated. Keep in mind the folder names also match the names of the controller classes, service classes, method names, etc. throughout the system which makes it easier to find your way around.

Another thing to keep in mind is that placing your Craft templates in your web root would make the raw template files publicly accessible from a web browser. So if you decide to go this route, be sure to place a .htaccess file in your templates folder with this:

Deny from all

That will tell Apache to protect the files from direct HTTP traffic, even though they live within the web root.

| improve this answer | |
  • @Brad I was looking for that link. Thanks. – Douglas McDonald Oct 23 '14 at 1:28
  • No worries... :) – Brad Bell Oct 23 '14 at 1:29
  • Thanks, Brandon. We would be moving them out of the webroot where we keep our theme SASS files and uncompressed JS, so all the theme is in one place, but I will take your advice and have a play around first. – Russ Back Oct 23 '14 at 10:46

Your Answer

