In this knowledgebase, you will learn how to set up a .htaccess file for redirecting to Laravel’s public folder. In Laravel the path for serving your web page is in the /public folder.
By default after installing Laravel and navigating in a browser to the URL you will see a directory listing of all the Laravel files. Here’s an easy way to use a .htaccess file to redirect requests of users to the Laravel /public folder mod_rewrite.
Create a .htaccess file in your root directory and add the following code.
# That was ONLY to protect you from 500 errors
# if your server did not have mod_rewrite enabled
RewriteEngine On
# RewriteBase /
# NOT needed unless you're using mod_alias to redirect
RewriteCond %{REQUEST_URI} !/public
RewriteRule ^(.*)$ public/$1 [L]
# Direct all requests to /public folder