Laravel 4 removing public from URL

后端 未结 20 2188
一个人的身影
一个人的身影 2020-11-29 04:33

So, I\'m running xampp on Windows. I\'m currently trying to get familiar with the laravel framework. Now, when thats pointed out. How can i be able to access my laravel appl

20条回答
  •  孤街浪徒
    2020-11-29 04:34

    I've been struggling with this problem too but i've found a simple solution that only requires you to create another .htaccess at the root of your application.

    The .htaccess itself should contain this:

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^{yoursite}.{extension} [NC]
    RewriteRule (.*) http://www.{yoursite}.{extension}/$1 [R=301,L]
    
    RewriteCond %{REQUEST_URI} !public/
    RewriteRule (.*) /public/$1 [L]
    

    The complete system keeps working but it redirects to the /public folder.

    This is how I solved the problem for myself.

    Hope it helps!

    Cheers.

提交回复
热议问题