<p>I found the solution after a lot of poking and prodding:</p>
<pre><code>'aliases' =&gt; [
    '@assetBaseUrl' =&gt; '/distribution/assets/',
    '@assetBasePath' =&gt; '/path/to/the/assets/',
],
</code></pre>
<p>Added into the general.php file in config did the magic.</p>
<p>I still needed to alias the imager folder but all seems to be working well now in a sub-folder.</p>

CC BY-SA 4.0
2021-08-26T17:50:10.710Z
2021-08-26T17:50:10.710Z
steve
<p>Unusual use-case - but I have a client with two websites they're merging into one. Their aim is to make the Craft 3 site (currently on its own top level domain) run in a /distribution sub folder.</p>
<p>I've managed to get this largely working by using the apache alias command:</p>
<pre><code>Alias /distribution &quot;/path/to/craftsite/web/&quot;
</code></pre>
<p>and updating the site .env and config file to have the /distribution/ folder on the end of the <code>DEFAULT_SITE_URL</code>.</p>
<p>The site now loads but struggles loading CSS, JS and images as it's looking for these at the higher level than the /distribution folder which is aliased.</p>
<p>Is there an easy way to add a prefix to the path Craft is loading all the assets from?</p>

CC BY-SA 4.0
2021-08-26T15:58:10.803Z
Is this about the public assets or the cpresources for the backend?
Max Strebel
CC BY-SA 4.0
2021-08-26T16:43:43.520Z
Public assets so far (I may yet encounter issues with cpresources further through testing though...).
steve
<assets><subfolder><alias>
Craft site in subfolder of domain
# Craft site in subfolder of domain

(Asked by: username_0 on 2021-08-26)

Unusual use-case - but I have a client with two websites they're merging into one. Their aim is to make the Craft 3 site (currently on its own top level domain) run in a /distribution sub folder.
I've managed to get this largely working by using the apache alias command:
Alias /distribution "/path/to/craftsite/web/"

and updating the site .env and config file to have the /distribution/ folder on the end of the DEFAULT_SITE_URL.
The site now loads but struggles loading CSS, JS and images as it's looking for these at the higher level than the /distribution folder which is aliased.
Is there an easy way to add a prefix to the path Craft is loading all the assets from?

**Tags:** assets, subfolder, alias

> **Comments:**
> **username_1**: Is this about the public assets or the cpresources for the backend?  
> **username_0**: Public assets so far (I may yet encounter issues with cpresources further through testing though...).  

---

## 1 answers

### Answer by username_0 on 2021-08-26. Score: 1 | Accepted answer

I found the solution after a lot of poking and prodding:
'aliases' => [
    '@assetBaseUrl' => '/distribution/assets/',
    '@assetBasePath' => '/path/to/the/assets/',
],

Added into the general.php file in config did the magic.
I still needed to alias the imager folder but all seems to be working well now in a sub-folder.


---

