My ISP doesn't allow my cpanel hosted laravel site to have a custom root folder (the public folder within Laravel's structure).
This means I can't make the server see /public_html/public as the root. It has to always be /public_html
Following their guidance I have setup the following /public_html/.htaccess rule to make the Laravel public folder appear as the root folder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
This works more or less but NOT completely. The issue is that if I request a page on my site with an ending backslash, the page url ends up as
www.domain-name.com/public/contact-us
instead of what I would expect which is
www.domain-name.com/contact-us
I assume this must be a problem with the .htaccess but I've tried various permutations and can't resolve it. I maybe wrong though, maybe it's something that ultimately needs to be fixed by a Laravel redirect after a url check.
It's driving me mad, I'd really appreciate any ideas!