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

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

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

CC BY-SA 3.0
2018-04-23T12:42:38.843Z
[craft] is above web root, [www] is the web root
laurent
CC BY-SA 3.0
2018-04-23T12:49:50.020Z
In that case it should work fine. Have you made changes to .htaccess?
Seth Warburton
CC BY-SA 3.0
2018-04-23T12:50:57.290Z
Full server path needed to be included in place or the magic _ _ DIR _ _ constant in index.php
laurent
CC BY-SA 3.0
2018-04-23T12:53:13.173Z
It _could_ work with craft2, but craft 3 has a different folder structure . Thanks for helping anyway
laurent
CC BY-SA 3.0
2018-04-23T12:30:47.357Z
2018-04-23T12:30:47.357Z
Seth Warburton
<p>You have to define the path to Craft in your <code>www/index.php</code> file.</p>

<pre><code>define('CRAFT_BASE_PATH', __DIR__ . '/../craft/' ); // &lt;- in your case something like this
</code></pre>

<p>The constant <code>CRAFT_BASE_PATH</code> must point to your <code>/craft</code> folder     </p>

CC BY-SA 3.0
2018-04-23T12:48:52.250Z
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
CC BY-SA 3.0
2018-04-23T12:23:55.900Z
2018-04-23T12:23:55.900Z
Robin Schambach
<p>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 :</p>

<pre><code>craft
-- config
-- modules
-- storage
-- vendor
-- etc...
www
-- index.php
-- web.config
-- etc.
</code></pre>

<p>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 ?</p>

<craft3>
What changes are needed if I change directory structure?
# What changes are needed if I change directory structure?

(Asked by: username_0 on 2018-04-23)

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 :
craft
-- config
-- modules
-- storage
-- vendor
-- etc...
www
-- 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 ?

**Tags:** craft3


---

## 2 answers

### Answer by username_1 on 2018-04-23. Score: 1

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/`.

> **Comments:**
> **username_0**: [craft] is above web root, [www] is the web root  
> **username_1**: In that case it should work fine. Have you made changes to .htaccess?  
> **username_0**: Full server path needed to be included in place or the magic _ _ DIR _ _ constant in index.php  
> **username_0**: It _could_ work with craft2, but craft 3 has a different folder structure . Thanks for helping anyway  

---

### Answer by username_2 on 2018-04-23. Score: 1

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

> **Comments:**
> **username_0**: Your code does NOT work btw, but I replaced _ _ DIR _ _ with the full server path for the craft folder and it does the trick  

---

