I can't have a mess of craft stuff at the root of my server so I try to use the following directory structure, with craft files and folders gathered in a craft directory :

-- config
-- modules
-- storage
-- vendor
-- etc...
-- index.php
-- web.config
-- etc.

This structure gives me a 500 error. I assume I can change a path variable somewhere, but I just can't find where. Any ideas ?

2 Answers 2


You have to define the path to Craft in your www/index.php file.

define('CRAFT_BASE_PATH', __DIR__ . '/../craft/' ); // <- in your case something like this

The constant CRAFT_BASE_PATH must point to your /craft folder

  • Your code does NOT work btw, but I replaced _ _ DIR _ _ with the full server path for the craft folder and it does the trick
    – laurent
    Apr 23, 2018 at 12:48

You should not be placing Craft at the root of your server, ideally you would place it one level above the Web Root directory, i.e. the one your domain name resolves to.

So, depending on your server OS you would need something like var/www/example.com/craft/ and var/www/example.com/www/ where var/www/example.com/www/ is the Web Root.

Just to add, this is the structure Craft is configured to expect, out-of-the-box, but with the publicly acceesible folder being public_html/ rather than www/.

  • [craft] is above web root, [www] is the web root
    – laurent
    Apr 23, 2018 at 12:42
  • In that case it should work fine. Have you made changes to .htaccess? Apr 23, 2018 at 12:49
  • Full server path needed to be included in place or the magic _ _ DIR _ _ constant in index.php
    – laurent
    Apr 23, 2018 at 12:50
  • It could work with craft2, but craft 3 has a different folder structure . Thanks for helping anyway
    – laurent
    Apr 23, 2018 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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