PHP Constants

There are a few optional PHP constants that you can define which affect Craft at a lower level than the config settings.

If you wish to define any of these constants for your site, you should put them in the index.php file in your site’s web root, after setting $craftPath:

// Path to your craft/ folder
$craftPath = '../../craft';

// This is for the Dutch site
define('CRAFT_SITE_URL', '');
define('CRAFT_LOCALE',   'nl');

General Constants #


Defines the name of the current environment, which defaults to the server’s host name. (See Multi-Environment Configs for more info.)

define('CRAFT_ENVIRONMENT', 'dev');


Sets the locale for the current request. Without setting this, your site’s primary locale will always be used.

define('CRAFT_LOCALE', 'nl');


Overrides the Site URL setting in Settings → General. That can be useful in combination with CRAFT_LOCALE for creating a locale-specific version of your site.

define('CRAFT_SITE_URL', "");

You’re free to use environment-specific variables in the value as well:

define('CRAFT_SITE_URL', "http://{host}/nl");

Path Constants #

You don’t have to keep all of the craft/* subfolders in one place. The following constants can be used to split the folder up into multiple locations, which can be useful if you want to share some files between multiple sites. See Sharing a craft/app Folder Across Multiple Sites for more info.


Craft uses this as the starting point for finding all of the folders traditionally located in craft/, with the notable exception of craft/app/, whose path gets defined with the help of your $craftPath variable in index.php.

// Path to your craft/ folder (where the app/ folder lives)
$craftPath = '../../craft';

// Path to where the rest of the craft/* folders live
define('CRAFT_BASE_PATH', '../craft_sitefiles/');


Defines the path to your craft/config/ folder.

define('CRAFT_CONFIG_PATH', '../craft_sitefiles/config/');


Defines the path to your craft/plugins/ folder.

define('CRAFT_PLUGINS_PATH', '../craft_sitefiles/plugins/');


Defines the path to your craft/storage/ folder.

define('CRAFT_STORAGE_PATH', '../craft_sitefiles/storage/');


Defines the path to your craft/templates/ folder.

define('CRAFT_TEMPLATES_PATH', '../craft_sitefiles/templates/');


Defines the path to your craft/translations/ folder.

define('CRAFT_TRANSLATIONS_PATH', '../craft_sitefiles/translations/');