There must be a simple answer for this but despite fumbling around with it for quite a while and searching the web for answers I am stymied. Perhaps I'm approaching it in the wrong way. I'm feeling like a beginner and I may not be using the right terminology here.

Here is a similar question without an accepted answer: How to setup assets in multi site where each site should have its own assets?

I have two sites, Site A and Site B, with their own assets folder. They are separate sites that will not share assets at all and it would be ideal to keep them completely separate (just as the templates are separated in folders with each Site's handle).

-- /site-a-assets
-- /site-b-assets

I've seen that @web should not be used for Asset Volumes' Base URL when using multi-site, but I haven't been able to understand how to set up config/default.php to accommodate different addresses for different sites AND different environments (e.g. dev, production). I've seen mention of using aliases but don't understand yet how to make them work with multiple sites to have different values for the same alias depending on which site you're viewing and in which environment.

I have this for my local siteUrl in config/default.php inside of environment settings:

'siteUrl' => [
  'site-a' => 'https://org.site-a',
  'site-b' => 'https://org.site-b',

It feels like I'm close but I can't get the pieces put together.

Any pointers you can give will be greatly appreciated!

  • I'm realizing this is probably not possible to do dynamically because the CP may/should be accessed from a certain domain/path. That means that any "other" site's Asset Volumes will use the "main" site's domain/path if set dynamically (assuming the "main" site's domain is used to access the CP. So, probably need to have a central assets repository for all sites, perhaps with subfolders per-site. I'd love to be shown that I'm wrong that that is the only way to do it. Commented Dec 17, 2019 at 15:35

1 Answer 1


As happens, I had to "give up" and ask for help in order to figure out a solution myself.

My issue was I was trying to dynamically set @web and @webroot for the sake of Asset Volumes. That would presumably mess up other things that use those aliases.

A way to make it work is to create new aliases per-site for Asset Volumes. If someone else wants to do this, here is a way.

In config/general.php create aliases in the appropriate spot (e.g. in the * global, dev or whatever environment section you want) replacing <site-handle> with the handle of your site (set in the Settings > Sites panel):

'aliases' => [
  '@<site-handle>AssetsBaseUrl' => 'https://site-a.dev',
  '@<site-handle>AssetsBasePath' => '/Users/kirkroberts/Work/Codebases/site-a.com/online/public_html',

Now for the Asset Volumes for that particular site you can use @<site-handle>AssetsBaseUrl or @<site-handle>AssetsBaseUrl to start your Base URL and File System Path fields, respectively. (replacing <site-handle> with that Site's handle)

This should enable assets to be stored in whatever domain/folder you specify.

Of course, the aliases will need to be set manually for each environment in config/general.php, which is kind of a pain but not a huge deal.

Maybe that will help someone get it done or find an even better way to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.