Redirect to public folder on Lumen (Laravel)

前端 未结 1 1959
你的背包
你的背包 2020-12-06 07:12

I have a big problem. I work on an application in localhost with Lumen framework. My work environment is on Wamp (Windows).

Lumen requires the root to be in the

相关标签:
1条回答
  • 2020-12-06 07:59

    Ok, after days of search, I have found the solution.

    Add a .htaccess file in the root of the application and add this in this file :

    RewriteEngine On
    
    RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
    RewriteRule ^ %1 [L,NE,R=302]
    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
    

    Assuming you haven't touched the original architecture of Lumen, and that public data is still in the same place : the public/ folder

    EDIT :

    With the last version of Lumen and Laravel, you just could write it in the .htaccess file :

    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
    

    Or follow the second method of this tutorial

    0 讨论(0)
提交回复
热议问题