.htaccess for Laravel

I was just playing around with a Laravel installation on free hosting.

Normally, you should change the document root of your website to the public folder with Laravel. You can’t do this on free hosting, but you can simulate this with .htaccess rules. These are the the .htaccess rules I used:

RewriteEngine On
RewriteRule (.*) /public/$1 [L]

Simply create a file with the name .htaccess and these contents and upload it directly to your htdocs folder. This should rewrite all web requests to the public folder, without showing this in the URL or potentially exposing system files.

Read the full guide in the knowledge base!

There is now an extensive guide in the knowledge base about how to set up Laravel on InfinityFree! Check it out for more information and troubleshooting steps.

How to install a Laravel site on InfinityFree

I finally found my answer (not related to laravel) after long time! Thank you :smile: