【问题标题】:No .htaccess file is working with Laravel Lumen 5.2没有 .htaccess 文件与 Laravel Lumen 5.2 一起使用
【发布时间】:2016-11-15 00:05:54
【问题描述】:

我已经在我的 lumen 的公共文件夹中使用 .htaccess 文件尝试了几乎所有可能的选项,但它们都没有给我漂亮的 URL。

在以前的 Lumen 版本中,我没有触及任何 .htaccess 规则,但过去一切都可以与随附的默认 .htaccess 文件完美配合。 但在这个新版本 5.2 中似乎没有任何效果。

默认如下:

# Apache configuration file
# http://httpd.apache.org/docs/2.2/mod/quickreference.html

# Note: ".htaccess" files are an overhead for each request. This logic     should
# be placed in your Apache config whenever possible.
# http://httpd.apache.org/docs/2.2/howto/htaccess.html

# Turning on the rewrite engine is necessary for the following rules and
# features. "+FollowSymLinks" must be enabled for this to work symbolically.

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
</IfModule>

# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

有什么想法吗?!

【问题讨论】:

    标签: .htaccess laravel lumen


    【解决方案1】:

    在您的 apache 配置文件(httpd.conf 或 apache2.conf)中,您必须将“AllowOverride”更改为“All”:

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    

    【讨论】:

      猜你喜欢
      • 2016-09-21
      • 2017-05-22
      • 2016-06-02
      • 2017-09-30
      • 2019-03-30
      • 2016-11-26
      • 2016-05-26
      • 2016-07-14
      • 2016-05-26
      相关资源
      最近更新 更多