dimanche 15 septembre 2019

Laravel redirect issue for custom root folder

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

https://ift.tt/2AkF0Nd

instead of what I would expect which is

https://ift.tt/2QdNErz

I assume this must be a problem with the .htaccess but I've tried various permutations and can't resolve it.

It's driving me mad, I'd really appreciate any ideas!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire