3

I am a little bit confused by the documentation about assets. It says that paths are relatives from the directory that holds the index.php file.

Now, I am working on multisite, with the following folders:
craft/web/site1/
craft/web/site2/

Is it possible to have:
craft/assets/site1/
craft/assets/site2/

Or:
craft/web/site1/assets/
craft/web/site2/assets/

  • If you want your assets to be publicly available I think they would need to be under the /web directory. – Cavell Blood Jan 2 '18 at 14:18
1

Your second example is easy enough... just make sure the assets folder exists under both of the site1 and site2 folders, the under your Asset Volume settings in the Control Panel, set the "File System Path" to the relative assets.

| improve this answer | |
  • Thank you for your kind answer, but that's not easy for me. :-( I created the assets folders, so that I have "craft/web/site1/assets" and "craft/web/site2/assets", but what path do I use? I tried many and when I try to rebuild the cache, Craft says 'Impossible to create the root directory "/assets"'. I know Craft have writing privileges into the sites folders, so what I am missing here? – Braintrash Dec 31 '17 at 22:51
  • Sorry, wasn't being condescending. Just meant that the first example is more complicated. :) – Brad Bell Dec 31 '17 at 22:55
  • 1
    The path should be just assets. When you set that, are you able to upload a file from the Control Panel? – Brad Bell Dec 31 '17 at 22:56
  • Oh, I didn't think you were condescending, just too much familiar with Craft. ;-) I have some progress: I was mislead by Craft recommending me an absolute path (“/path/to/folder”) and I used "/assets" instead of just "assets". Index rebuilding is now working and I can upload files BUT they all go into the "site1/assets" folder. – Braintrash Dec 31 '17 at 23:05
  • In your 2nd site's index.php file, did you define the CRAFT_SITE PHP constant? i.e. define('CRAFT_SITE', 'site2'); where site2 is whatever th handle for your 2nd site is under Settings->Sites in the Control Panel. – Brad Bell Dec 31 '17 at 23:18
1

I think I got it right, going the first solution I planned. So, in my Craft project directory ("craft"), I created "craft/assets/site1" and "craft/assets/site2" and when going into the admin panel and setting up the ressources, using "../../assets/site1" and "../../assets/site2" did the trick, everything working as expected. So, really, my source of confusion here was Craft recommending me “/path/to/folder” which lead me to add a / at the beginning of my paths; once I got rid of that, problem was solved. Thank you very much for your help ! :-)

| improve this answer | |
  • Glad you're all sorted! – Brad Bell Dec 31 '17 at 23:22
  • Because you so kindly helped me. Thank you again for that! :-) – Braintrash Dec 31 '17 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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