【问题标题】:Laravel 6 : Remove Public from URL using htaccessLaravel 6:使用 htaccess 从 URL 中删除 Public
【发布时间】:2020-01-17 11:16:21
【问题描述】:

全部

我想使用 htaccess 从 url 中删除 public,我尝试了很多方法,但它在 laravel 6 中不起作用。我正在使用这种方式的最新版本:https://hdtuto.com/article/laravel-remove-public-from-url-using-htaccess

但结果相同,有什么建议吗?

【问题讨论】:

    标签: .htaccess directory public


    【解决方案1】:

    解决了!!!

    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
       Options -MultiViews
    </IfModule>
    
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]
    
    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php
    

    来源:How to remove public from laravel url

    【讨论】:

      猜你喜欢
      • 2016-07-30
      • 2020-01-20
      • 2015-01-14
      • 2020-06-07
      • 1970-01-01
      • 1970-01-01
      • 2015-11-17
      • 2016-03-06
      • 2017-09-28
      相关资源
      最近更新 更多