Skip to main content

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 more help?  Take a look here.

Thanks for stopping by. Happy coding!


  • Over Martinez says:

    Hi, I’m have a question.

    I have 2 laravel projects in my server, How can I do to make it works, Thank you very much for any help that you can give me.

    • Micky says:

      I would suggest using different hostnames (domain names) for each project.

    • Prodjex says:

      It all depends on your setup, would need some more information to help you.
      1. Are they under the same account but different sub-domains?
      2. Are they two different domains and .htaccess is not routing correctly?

      All depends on your setup. I run some setups where I have the same domain such as:

Leave a Reply