With CakePHP, the primary and easiest way is to install it via composer. As specified in the CakePHP installation instructions.

If you follow those instructions, you’ll end up with a subfolder in your public HTTP folder of your hosting. And even if you try to create the project directly in your main, public HTTP folder of your hosting, composer won’t do it because the folder may not be empty.

It’s fine though, install CakePHP in a subfolder and rewrite it so that the subfolder is removed from the CakePHP URLs then you can run the CakePHP project on the main domain name.

You could do this via .htaccess and I tried with some success but the quickest and easiest way of achieving this is by opening the config/app.php file.

Then set App.base to an empty string ('') or just a slash (/).

And that’s all there is to it, enjoy!