How to make my route accessible without using public in shared hosting using laravel, I tried to use this .htaccess but it is not working
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
Im currently using hostinger and my folder structure is
->public_html
->laravel files
My index is inside public folder
I tried this .htaccess code but not working
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
My index is inside public folder
2
Answers
Move your
index.php
and.htaccess
files under the public folder to parent folder.Don’t forget to fix the paths in your
index.php
file. Like this:Your project will be triggered in public_html.
The best practice for this case is by creating htaccess like this : How do you redirect all request to public/ folder in laravel 5
But we still have a "not too recommended" trick to handle limited functionality of hosting provider :
/../
with/private/
. Example :Keep in mind that this trick have a security issue. You need to protect all private files from public access.