Remove public URL on shared hosting | Laravel
Mon, 17 Dec 2018
Laravel out of the oven is not prepared for being deployed on shared hosting.
I often use shared hosting for testing web apps as it's the easiest and fastest way of having an app running in WWW.
See bellow what changes are required in order to make Laravel work on shared hosting.
First step is to complete the Laravel setup. You'll notice that you can access the app by placing /public/ in the URL. This is obviously not fancy at all.
Fix it by replacing the content of .htaccess in the root directory with the code bellow:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
That's all. Remove the /public/ and refresh.
Check my other Laravel posts.
Categories: how-to, laravel