<p>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:</p>
<ol>
<li><p>general.php config file <code>'@webroot' =&gt; dirname(__DIR__) . '/domainname.tld',</code> you already did this, great!</p>
</li>
<li><p>bootstrap.php file</p>
</li>
<li><p>Craft executable file</p>
</li>
</ol>
<p>Try that out!</p>

CC BY-SA 4.0
2023-08-23T01:30:43.853Z
2023-08-23T01:30:43.853Z
cherrykoda
<p>I have a hosting account running Craft 4.4.17 with a structure like this:</p>
<pre><code>home/
    accname/
        craft's usual files and folder arrangement
        domainname.tld &lt;-- web root
            index.php
</code></pre>
<p>I'm struggling to define the path for the <code>@webroot</code> alias in <code>config/general.php</code> so that it evaluates to <code>/home/accname/domainname.tld</code>. That's what supposed to happen right?</p>
<p>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?</p>
<p>Doesn't <code>dirname(__DIR__)</code> in this context evaluate to <code>home/accname</code> ? – and therefore the following <em>should</em> work:</p>
<pre><code>'@webroot' =&gt; dirname(__DIR__) . '/domainname.tld',
</code></pre>
<p>For some reason that doesn't work but I don't know why. Perhaps I have fundamentally misunderstood something.</p>
<p>Why I say it doesn't work is because when I set a Filesystem's <code>Base path</code> <em>explicitly</em> with something like:</p>
<pre><code>/home/accname/domainname.tld/assets/general
</code></pre>
<p>…file uploads, previews, and transforms work.</p>
<p>But when I use the above <code>dirname</code> strategy and apply:</p>
<pre><code>@webroot/assets/general
</code></pre>
<p>…things break.</p>

<config><configuration><alias>
Help with configuring the @webroot alias
# Help with configuring the @webroot alias

(Asked by: username_0 on 2023-08-18)

I have a hosting account running Craft 4.4.17 with a structure like this:
home/
    accname/
        craft's usual files and folder arrangement
        domainname.tld <-- web root
            index.php

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:
/home/accname/domainname.tld/assets/general

…file uploads, previews, and transforms work.
But when I use the above dirname strategy and apply:
@webroot/assets/general

…things break.

**Tags:** config, configuration, alias

---

## 1 answers

### Answer by username_1 on 2023-08-23. Score: 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!


---

