<p>You should be able to rename the directory on the server and then update the Asset Source settings changing the URL and system path. It should take care of it as Asset folders are stored relative to the top folder.</p>

CC BY-SA 3.0
2017-05-12T15:20:30.203Z
2017-05-12T15:20:30.203Z
Andris Sevcenko
<p>I usually use environment variables in the config.php to define paths to folders.</p>

<pre><code>define('CRAFT_PUBLIC_PATH', realpath(dirname(__FILE__) . '/../') . '/public/');

return array(
    '*' =&gt; array(
        // ...
    ),

    'example.dev' =&gt; array(
        // ...

        'environmentVariables' =&gt; array(
            'basePath' =&gt; '...',
            'baseUrl'  =&gt; '...',
            'assetsPath'  =&gt; CRAFT_PUBLIC_PATH . 'assets',
            'assetsUrl'  =&gt; '/assets',
        )
    ),
);
</code></pre>

<p>You can then use the path in your twig templates:</p>

<pre><code>{{ craft.config.environmentVariables.assetsUrl }}
</code></pre>

<p>And, if you define paths for Asset Sources, simply add the variable like this to the field:</p>

<pre><code>{assetsPath}
</code></pre>

<p>This way, you can change the path easily at one place, after you had to rename a folder. The config is taken from: <a href="https://craftcms.com/docs/multi-environment-configs" rel="nofollow noreferrer">https://craftcms.com/docs/multi-environment-configs</a>.</p>

<p>If you want to dig in deeper and make it completely right, I recommend following this advice (advanced): <a href="https://nystudio107.com/blog/multi-environment-config-for-craft-cms" rel="nofollow noreferrer">https://nystudio107.com/blog/multi-environment-config-for-craft-cms</a></p>

CC BY-SA 3.0
2017-05-12T15:24:23.320Z
2017-05-13T20:35:47.623Z
2017-05-13T20:35:47.623Z
Max Strebel
<p>I have come up against an issue, and I want to check the best way to resolve this; here is a brief explanation. </p>

<p>So by default I have setup the craft assets folder to be called 'resources' and this lives in the top level of the website (although I think location is irrelevant). The client has now introduced a section called resources that has several child pages and a top level page. Which is accessed at /resources/ - I think the most sensible change is to rename my resources folder that holds all the uploaded assets. I will probably rename it uploads. However, what is the best approach to rename this without upsetting the system or having big issues.</p>

<p>I should also mention my resources folder also contains several sub folders for assets too.</p>

<assets>
Conflict with assets folder and section URL
# Conflict with assets folder and section URL

(Asked by: username_0 on 2017-05-12)

I have come up against an issue, and I want to check the best way to resolve this; here is a brief explanation.

So by default I have setup the craft assets folder to be called 'resources' and this lives in the top level of the website (although I think location is irrelevant). The client has now introduced a section called resources that has several child pages and a top level page. Which is accessed at /resources/ - I think the most sensible change is to rename my resources folder that holds all the uploaded assets. I will probably rename it uploads. However, what is the best approach to rename this without upsetting the system or having big issues.

I should also mention my resources folder also contains several sub folders for assets too.

**Tags:** assets


---

## 2 answers

### Answer by username_1 on 2017-05-12. Score: 4 | Accepted answer

You should be able to rename the directory on the server and then update the Asset Source settings changing the URL and system path. It should take care of it as Asset folders are stored relative to the top folder.


---

### Answer by username_2 on 2017-05-12. Score: 3

I usually use environment variables in the config.php to define paths to folders.
define('CRAFT_PUBLIC_PATH', realpath(dirname(__FILE__) . '/../') . '/public/');

return array(
    '*' => array(
        // ...
    ),

    'example.dev' => array(
        // ...

        'environmentVariables' => array(
            'basePath' => '...',
            'baseUrl'  => '...',
            'assetsPath'  => CRAFT_PUBLIC_PATH . 'assets',
            'assetsUrl'  => '/assets',
        )
    ),
);

You can then use the path in your twig templates:
{{ craft.config.environmentVariables.assetsUrl }}

And, if you define paths for Asset Sources, simply add the variable like this to the field:
{assetsPath}

This way, you can change the path easily at one place, after you had to rename a folder. The config is taken from: https://craftcms.com/docs/multi-environment-configs.
If you want to dig in deeper and make it completely right, I recommend following this advice (advanced): https://nystudio107.com/blog/multi-environment-config-for-craft-cms


---

