Remove public/ from URLs?

Silverstripe Version: 4.4.3

I’ve been away from SilverStripe for a couple of years and I’ve come back to have another look. I’ve followed the latest lessons to the letter, installed SilverStripe to my (shared host) dev platform using Composer. The installation went fine and I now have a basic install at https://www.brandsistency.dev/silverstripe/public/.

Looking at the lessons, the creation of the public/ folder is now a SilverStripe default but I just can’t figure out how to remove “public/” from the URL. I want the site to be accessed via https://www.brandsistency.dev/silverstripe. I’m guessing it’s a rewrite rule in an .htaccess file somewhere but that’s not my area of expertise. And there are multiple .htaccess files.

How do I remove “public/” from the URLs. Please help!

When installing in a subdirectory, I tend to not bother with the public directory. So I’ll move all the files out of it, up to the top-level directory (then delete the public directory altogether).

The public directory system comes into its own when you’re not using a subdirectory for the site. It allows you to point the document root of the domain directly at the public directory. (eg. with Apache your setup would have something like DocumentRoot /var/www/mywebsite/public)

With that in place, the webserver will only serve files from the public directory and below (since it’s been told that the public directory is the root) and that means that all your template files, php, etc. are outside of a publicly-accessible directory… which helps with security.