On most shared hosting, you can't set the webroot. As an alternative, a rewriterule to the web folder can do this. Could be something like RewriteRule ^(.*)$ web/$1 [L].

This works on main sites in Craft 3, but breaks subsites.

I've found an answer from Brandon Kelly, suggesting to use different indexes.php and loading the correct one via the htaccess. (based on subsite prefix)

Is there a better solution since this date, that might prevent the need for different indexes?

  • 1
    What problem are you trying to solve, exactly? You can just rename the web folder to be whatever it is on your shared hosting.
    – Lindsey D
    Jun 25 '19 at 15:44
  • Currently, everything is placed in the webfolder and the htaccess is used to reroute all traffic to the web folder. This works, but causes subsites to return as 404. Is there a way to fix the rewrite for this? Or should I look into adding everything one folder above the webroot and rename the web folder?
    – Bert H
    Jun 26 '19 at 6:53

Your Answer

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

Browse other questions tagged or ask your own question.