I have a hosting account running Craft 4.4.17 with a structure like this:

        craft's usual files and folder arrangement
        domainname.tld <-- web root

I'm struggling to define the path for the @webroot alias in config/general.php so that it evaluates to /home/accname/domainname.tld. That's what supposed to happen right?

Is there an invariant way to express the path that should work for this structure or is it subject to hosting variables I don't have sight of?

Doesn't dirname(__DIR__) in this context evaluate to home/accname ? – and therefore the following should work:

'@webroot' => dirname(__DIR__) . '/domainname.tld',

For some reason that doesn't work but I don't know why. Perhaps I have fundamentally misunderstood something.

Why I say it doesn't work is because when I set a Filesystem's Base path explicitly with something like:


…file uploads, previews, and transforms work.

But when I use the above dirname strategy and apply:


…things break.

1 Answer 1


We put all of Craft's codebase into a craft folder where I work, so its along the same type of edit as what you're experiencing. Here's where you need to edit:

  1. general.php config file '@webroot' => dirname(__DIR__) . '/domainname.tld', you already did this, great!

  2. bootstrap.php file

  3. Craft executable file

Try that out!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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