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.

[templatera id=”8000″]

Need help?  Check out our Web Development in Kansas City

Thanks for stopping by. Happy coding!

4 Comments

  • Over Martinez 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 Micky says:

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

    • Prodjex 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:
      -admin.domain.com
      -app.domain.com
      -portal.domain.com

Leave a Reply