Skip to content
Prodjex

How to Set Up an .htaccess File to Redirect to Laravel's Public Folder

1 min read

How to Set Up an .htaccess File to Redirect 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 using an .htaccess file to redirect requests to the Laravel /public folder user mod_rewrite.

Create a .htaccess file in your root directory and add the following code.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

Save your file and refresh your browser, you should now see the default Laravel splash page. Need help?  Check out our Web Development in Kansas City

Thanks for stopping by. Happy coding!

Security update (October 2026): two critical vulnerabilities in PHP itself affect nearly every PHP version. Read what PHP2Shell means for your site and how to patch it.

  • .htaccess
  • laravel
  • mod rewrite
  • mod_rewrite
  • public
  • redirect

Keep reading