<p>First of all you should remove all "language" subfolders from your <code>web</code> directory because your web server will route directly in those instead of your default <code>web/index.php</code>. Craft will determinate the <code>CurrentSite</code> depending on your url not on the location of the file.</p>

<p>Second: make sure to insert an array with <code>aliases</code> in your <code>config/general.php</code> 
I'll show a "complex" solution for multiple asset sources for multiple sites. If your site shares the same resources you'll just need the first array element but I want to show the concept</p>

<pre><code>$publicPath = realpath(dirname(__DIR__) . '/web');
// ....
'aliases' =&gt; [
    'assetPath1'    =&gt; $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'folder1' . DIRECTORY_SEPARATOR,
    'assetPath2'    =&gt; $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'folder2' . DIRECTORY_SEPARATOR,
    //....
]
</code></pre>

<p>You should <strong>never</strong> access those files with </p>

<pre><code>&lt;script src="`{{ siteUrl }}/assets/folder1/jquery.js`"&gt;
</code></pre>

<p>Because this will use the current site url and append the structure. Therefore you have the <code>alias</code> function</p>

<pre><code>&lt;script src="`{{ alias('assetPath1') }}/assets/folder1/jquery.js`"&gt;
</code></pre>

<p>Now you can do some fancy stuff like</p>

<pre><code>&lt;script src="`{{ alias('assetPath' ~ currentSite.id) }}/assets/folder1/jquery.js`"&gt;
</code></pre>

<p>Or whatever identifier you like to access your asset files dynamically. </p>

CC BY-SA 3.0
2018-04-06T12:02:18.543Z
It might be worthwhile to check if this is a completely reliable solution, as it is in opposition with what the Craft Google Hangout video says to do. However, I think the Craft Google Hangout video is not sufficient, and its about time that this be well documented from Craft themselves.
Dan Zuzevich
CC BY-SA 3.0
2018-04-06T12:03:33.027Z
Specifically, the Hangout video says to create folders for each language inside of web. However, I dont have time to go back and watch this video again, aka the need for docs.
Dan Zuzevich
CC BY-SA 3.0
2018-04-06T13:22:07.343Z
Are you sure they are about Craft 3 and not Craft 2?
Robin Schambach
CC BY-SA 3.0
2018-04-06T13:22:57.917Z
Found the video here https://craftcms.stackexchange.com/questions/19601/multi-site-setup-in-craft3
Dan Zuzevich
CC BY-SA 3.0
2018-04-05T13:50:27.187Z
2018-04-05T13:50:27.187Z
Robin Schambach
<p>Use aliases, by first defining them in your general.php:</p>

<pre><code>'dev' =&gt; [
        'siteUrl' =&gt; [
          'default' =&gt; 'https://site.test',
          'korean' =&gt; 'https://site.test/ko',
          'brazil' =&gt; 'https://site.test/pt'
        ],
        'devMode' =&gt; true,
        'aliases' =&gt; [
            '@baseUrl' =&gt; 'http://site.test',
        ],
]
</code></pre>

<p>Then in your templates you can now use {{ alias('@baseUrl') }}</p>

<pre><code>&lt;script type="text/javascript" src="{{ alias('@baseUrl') }}/ui/vendor/enquire/enquire.min.js"&gt;&lt;/script&gt;
</code></pre>

<p>For more info, see <a href="https://github.com/nystudio107/craft3-multi-environment" rel="nofollow noreferrer">https://github.com/nystudio107/craft3-multi-environment</a></p>

CC BY-SA 3.0
2018-04-05T15:36:21.557Z
Thanks man. Robins answer also pointed out the fact that I needed to remove the language folders, which was key to craft not trying to serve files from inside those folders. With the alias piece, and removing those folders, everything works.
Dan Zuzevich
CC BY-SA 3.0
2018-04-05T14:01:33.513Z
2018-04-05T14:36:26.727Z
2018-04-05T14:36:26.727Z
Jolle
<p>Okay, I am here because I would like to have a site in the following structure:</p>

<ul>
<li><a href="https://site.com" rel="nofollow noreferrer">https://site.com</a>  (default english version)</li>
<li><a href="https://site.com/ko" rel="nofollow noreferrer">https://site.com/ko</a> (korean)</li>
<li><a href="https://site.com/pt" rel="nofollow noreferrer">https://site.com/pt</a> (portuguese)</li>
</ul>

<p>I would like to use <strong>ONE</strong> uploads folder to store all of the assets for all 3 languages(plus any additional languages added after), use all of the same templates, and use all of the same css and js files.</p>

<p>My current directory structure is the craft 3 default(I used the cli installer, which is great). Here is the important pieces of what my directory looks like:</p>

<pre><code>-templates
- web
   - dist
      - js
      - css
   - uploads
   - ko
   - pt
</code></pre>

<p>Lets say I have the following templates:</p>

<pre><code>- home.html
- newsroom.html
- whitepapers.html
- help.html
</code></pre>

<p>I would expect to be able to visit each in the following manner:</p>

<pre><code>(Home)
- https://site.com
- https:///site.com/ko
- https://site.com/pt

(Newsroom)
- https://site.com/newsroom
- https:///site.com/ko/newsroom
- https://site.com/pt/newsroom

...etc hopefully you get the picture.
</code></pre>

<p>Is this at all possible with Craft 3? I keep running into issues where each languages site is trying to pull in the uploads or css/js assets from within their respective folders:</p>

<p><a href="https://i.sstatic.net/a9toR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/a9toR.png" alt="enter image description here"></a></p>

<p>Also, here is the sites config in general.php:</p>

<pre><code>'dev' =&gt; [
        'siteUrl' =&gt; [
          'default' =&gt; 'https://site.test',
          'korean' =&gt; 'https://site.test/ko',
          'brazil' =&gt; 'https://site.test/pt'
        ],
        'devMode' =&gt; true,
 ]
</code></pre>

<p><strong>SOLUTION</strong>
For anyone visiting this in the future, here are the updates to my config that solved the problem. Please refer to this after you have read Robin and Jolle's answers, they are both very helpful.</p>

<pre><code>'dev' =&gt; [
        'siteUrl' =&gt; [
          'default' =&gt; 'http://site.test',
          'korean' =&gt; 'http://site.test/ko',
          'brazil' =&gt; 'http://site.test/bz'
        ],
        'aliases' =&gt; [
            'basePath' =&gt; '/Users/dzuz/localhost/site/web',
            'baseUrl'  =&gt; 'http://site.test/',
        ],
        'devMode' =&gt; true,
    ],
</code></pre>

CC BY-SA 3.0
2018-04-05T11:13:07.957Z
You should remove the `ko` and `pt` folders/files. Craft will only access one single `index.php` the site does not matter. The errors should be fixed then
Robin Schambach
CC BY-SA 3.0
2018-04-05T11:28:13.853Z
Testing this out now!
Dan Zuzevich
CC BY-SA 3.0
2018-04-05T11:39:56.420Z
I will happily create the most glorious craft 3 multi site setup tutorial the world has ever seen, but I cant even get passed these trivial problems.
Dan Zuzevich
<multi-site>
Craft 3 Multi Language Setup
# Craft 3 Multi Language Setup

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

Okay, I am here because I would like to have a site in the following structure:

https://site.com  (default english version)
https://site.com/ko (korean)
https://site.com/pt (portuguese)

I would like to use ONE uploads folder to store all of the assets for all 3 languages(plus any additional languages added after), use all of the same templates, and use all of the same css and js files.
My current directory structure is the craft 3 default(I used the cli installer, which is great). Here is the important pieces of what my directory looks like:
-templates
- web
   - dist
      - js
      - css
   - uploads
   - ko
   - pt

Lets say I have the following templates:
- home.html
- newsroom.html
- whitepapers.html
- help.html

I would expect to be able to visit each in the following manner:
(Home)
- https://site.com
- https:///site.com/ko
- https://site.com/pt

(Newsroom)
- https://site.com/newsroom
- https:///site.com/ko/newsroom
- https://site.com/pt/newsroom

...etc hopefully you get the picture.

Is this at all possible with Craft 3? I keep running into issues where each languages site is trying to pull in the uploads or css/js assets from within their respective folders:

Also, here is the sites config in general.php:
'dev' => [
        'siteUrl' => [
          'default' => 'https://site.test',
          'korean' => 'https://site.test/ko',
          'brazil' => 'https://site.test/pt'
        ],
        'devMode' => true,
 ]

SOLUTION
For anyone visiting this in the future, here are the updates to my config that solved the problem. Please refer to this after you have read Robin and Jolle's answers, they are both very helpful.
'dev' => [
        'siteUrl' => [
          'default' => 'http://site.test',
          'korean' => 'http://site.test/ko',
          'brazil' => 'http://site.test/bz'
        ],
        'aliases' => [
            'basePath' => '/Users/dzuz/localhost/site/web',
            'baseUrl'  => 'http://site.test/',
        ],
        'devMode' => true,
    ],

**Tags:** multi-site
> **Comments:**
> **username_1**: You should remove the `ko` and `pt` folders/files. Craft will only access one single `index.php` the site does not matter. The errors should be fixed then  
> **username_0**: Testing this out now!  
> **username_0**: I will happily create the most glorious craft 3 multi site setup tutorial the world has ever seen, but I cant even get passed these trivial problems.  

---

## 2 answers

### Answer by username_1 on 2018-04-05. Score: 4 | Accepted answer

First of all you should remove all "language" subfolders from your web directory because your web server will route directly in those instead of your default web/index.php. Craft will determinate the CurrentSite depending on your url not on the location of the file.
Second: make sure to insert an array with aliases in your config/general.php 
I'll show a "complex" solution for multiple asset sources for multiple sites. If your site shares the same resources you'll just need the first array element but I want to show the concept
$publicPath = realpath(dirname(__DIR__) . '/web');
// ....
'aliases' => [
    'assetPath1'    => $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'folder1' . DIRECTORY_SEPARATOR,
    'assetPath2'    => $publicPath . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'folder2' . DIRECTORY_SEPARATOR,
    //....
]

You should never access those files with

> **Comments:**
> **username_0**: It might be worthwhile to check if this is a completely reliable solution, as it is in opposition with what the Craft Google Hangout video says to do. However, I think the Craft Google Hangout video is not sufficient, and its about time that this be well documented from Craft themselves.  
> **username_0**: Specifically, the Hangout video says to create folders for each language inside of web. However, I dont have time to go back and watch this video again, aka the need for docs.  
> **username_1**: Are you sure they are about Craft 3 and not Craft 2?  
> **username_0**: Found the video here https://craftcms.stackexchange.com/questions/19601/multi-site-setup-in-craft3  

---

### Answer by username_2 on 2018-04-05. Score: 4

Use aliases, by first defining them in your general.php:
'dev' => [
        'siteUrl' => [
          'default' => 'https://site.test',
          'korean' => 'https://site.test/ko',
          'brazil' => 'https://site.test/pt'
        ],
        'devMode' => true,
        'aliases' => [
            '@baseUrl' => 'http://site.test',
        ],
]

Then in your templates you can now use {{ alias('@baseUrl') }}


For more info, see https://github.com/nystudio107/craft3-multi-environment

> **Comments:**
> **username_0**: Thanks man. Robins answer also pointed out the fact that I needed to remove the language folders, which was key to craft not trying to serve files from inside those folders. With the alias piece, and removing those folders, everything works.  

---

