Setting my project public folder as document root

I am trying to set the public folder in my project as the document root.

I have explained everything in detail at this link with screenshots.

When I set the root to one folder above public the index files picks up the css file. Otherwise it does not… Not sure what the problem is. Any guidance is appreciated. Thanks.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

UNBELIEVABLE! There is answer on this whatsoever ANYWHERE. Garbage platform.

Thank you. I am all set for now. Thanks for your help!

If you use /var/www/ as your document root, then you don’t need any hack or function to build your links. This should work OK:

<img src="/images/gbi_logo.png" />

There’s no need to pull that info. Even $_SERVER['DOCUMENT_ROOT'] will give you the apache docroot but you don’t need that.

Perhaps I’m not fully understanding what you’re setting out to do.