I want to host my Laravel 4 project on free webhosting. To work, the hosting root dir must point to the "public" folder of my project where is taking place the .htaccess file. I did not succeed with finding free hosting which allows changing the root dir so I tried to place another .htaccess file in the main project dir which redirects to the public folder. Then the landing page opens but non of the routes in routes.php works. So my question is:
Is it possible to put the .htaccess file from "public" to the main dir and the application to work properly ?
Hope my question was clear.
Yes, you can do that from create a .htaccess file in your laravel root directory.and put below code in that file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
It should be redirected easily.
Another way to remove public folder
for more reference click here....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With