I have one client with hosting that doesn't permit me to move the Craft files below web root. It was fairly easy to point Craft 3 to the base files but I am having significant trouble finding the right combination in Craft 4.

If I keep the craft files below web root, it works in my dev environment. The moment I try to configure a hosting environment where the Craft4 files are in web root, the site will not load.

The installation instructions point to a Craft 3 page "Moving Craft Files Below Web the Web Root." This instruction makes sense and works in Craft 3, it does not seem to apply in Craft 4. It hasn't worked for me.

My next attempt has been to navigate the configuration settings and environment variables as found in Configuring Craft. No success.

Anyone have success with Craft4 files at webroot?

  • I would take a hard line on this and insist that the site is hosted elsewhere. For one thing, I would be really uncomfortable having 10,000+ third-party PHP files all publicly accessible at /vendor, not to mention other config files that could give away valuable details to hackers and bots. With a poorly configured server all it might take is a momentary service failure for someone to be able to read your .env file, for example, or steal your config/licence.key. Move host, the hassle is not worth the risks. Jun 21 at 8:19


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.