<p>To replicate what you did in craft 2, you would change your web/index.php to:</p>

<pre><code>define('CRAFT_BASE_PATH', dirname(__DIR__,1) . '/nameofthefolderwherecraftlives');
</code></pre>

<p>The <code>,1</code> tells craft to go up <strong>1</strong> level and change <code>/nameofthefolderwherecraftlives</code> to well... The name of the folder where craft lives :)</p>

<p>So for what I show you above, your structure will be:</p>

<ul>
<li>web

<ul>
<li>index.php</li>
</ul></li>
<li>nameofthefolderwherecraftlives

<ul>
<li>config</li>
<li>modules</li>
<li>storage</li>
<li>templates</li>
<li>vendor</li>
</ul></li>
</ul>

<p>It's <a href="https://docs.craftcms.com/v3/config/php-constants.html#craft-base-path" rel="nofollow noreferrer">here in the docs</a>.</p>

<p>Hope that helps!</p>

CC BY-SA 4.0
2019-01-22T18:40:42.187Z
Thanks. Makes sense but I don't think I explained throughly. I've updated my post with the structure (no web folder - it's content sits in the root)
sarah3585
CC BY-SA 4.0
2019-01-22T15:44:25.013Z
2019-01-22T15:44:25.013Z
Oli
<p>Oh I see. Then if the root folder where your index.php lives is let's say <code>public_html</code> you could do:</p>

<p><code>define('CRAFT_BASE_PATH', dirname(__DIR__) . '/public_html/craftcms');</code></p>

<p>Another solution would be to use <code>__FILE__</code> instead of <code>__DIR__</code> and you could do:</p>

<p><code>define('CRAFT_BASE_PATH', dirname(__FILE__) . '/craftcms');</code></p>

<p>However, I don't know the implications of the second option. It works for me when I test locally and doesn't break anything but I can't be sure... Maybe the Craft guys could tell us more on this..?</p>

<p>Anyway I hope this gets you up and running :)</p>

CC BY-SA 4.0
2019-01-23T11:19:01.850Z
2019-01-23T11:19:01.850Z
Oli
<p>I use subdomains for staging environments. That meant in Craft 2 I had to move the public_html folder content up a level and change</p>

<pre><code>$craftPath = '../craft';
</code></pre>

<p>To:</p>

<pre><code>$craftPath = 'craft';
</code></pre>

<p>I'm getting myself in a bit of a mess how to do this for Craft 3. I've moved the contents of 'web' into the root folder for the subdomain.</p>

<p>I think I have to change these settings</p>

<pre><code>define('CRAFT_BASE_PATH', dirname(__DIR__));
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');
</code></pre>

<p>but it's a bit over my head, so any help to what I change these to would be much appreciated.</p>

<p>My hosting doesn't allow configuring the webserver to point to the /web folder.</p>

<p>Structure:</p>

<ul>
<li>index.php</li>
<li>css</li>
<li>js</li>
<li>craftcms

<ul>
<li>config</li>
<li>modules</li>
<li>storage</li>
<li>templates</li>
<li>vendor</li>
</ul></li>
</ul>

<craft3><config>
Web folder content moved up a level - Craft Path settings
# Web folder content moved up a level - Craft Path settings

(Asked by: username_0 on 2019-01-22)

I use subdomains for staging environments. That meant in Craft 2 I had to move the public_html folder content up a level and change
$craftPath = '../craft';

To:
$craftPath = 'craft';

I'm getting myself in a bit of a mess how to do this for Craft 3. I've moved the contents of 'web' into the root folder for the subdomain.
I think I have to change these settings
define('CRAFT_BASE_PATH', dirname(__DIR__));
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');

but it's a bit over my head, so any help to what I change these to would be much appreciated.
My hosting doesn't allow configuring the webserver to point to the /web folder.
Structure:

index.php
css
js
craftcms


config
modules
storage
templates
vendor

**Tags:** craft3, config

---

## 2 answers

### Answer by username_1 on 2019-01-22. Score: 2

To replicate what you did in craft 2, you would change your web/index.php to:
define('CRAFT_BASE_PATH', dirname(__DIR__,1) . '/nameofthefolderwherecraftlives');

The ,1 tells craft to go up 1 level and change /nameofthefolderwherecraftlives to well... The name of the folder where craft lives :)
So for what I show you above, your structure will be:

web


index.php

nameofthefolderwherecraftlives


config
modules
storage
templates
vendor


It's here in the docs.
Hope that helps!

> **Comments:**
> **username_0**: Thanks. Makes sense but I don't think I explained throughly. I've updated my post with the structure (no web folder - it's content sits in the root)  

---

### Answer by username_1 on 2019-01-23. Score: 1

Oh I see. Then if the root folder where your index.php lives is let's say `public_html` you could do:

`define('CRAFT_BASE_PATH', dirname(__DIR__) . '/public_html/craftcms');`

Another solution would be to use `__FILE__` instead of `__DIR__` and you could do:

`define('CRAFT_BASE_PATH', dirname(__FILE__) . '/craftcms');`

However, I don't know the implications of the second option. It works for me when I test locally and doesn't break anything but I can't be sure... Maybe the Craft guys could tell us more on this..?

Anyway I hope this gets you up and running :)


---

