【问题标题】:Laravel .htaccess not workingLaravel .htaccess 不工作
【发布时间】:2014-04-13 03:55:19
【问题描述】:

Laravel 的默认 .htaccess 文件在 PHP 云服务器上出现错误。

错误:

此处不允许使用选项多视图

当我从 .htaccess 中删除以下部分时,我的主页工作,但其他路线给出了 404 错误。

<IfModule mod_negotiation.c>
     Options -MultiViews
</IfModule>

原始 .htaccess 文件

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

【问题讨论】:

  • 是哪个云服务器提供商?
  • 服务器提供者是phpcloud.com

标签: php apache .htaccess mod-rewrite laravel


【解决方案1】:

基于这些Google results herehere,我认为你需要追加/编辑:

RewriteBase /
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

总而言之:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

【讨论】:

    猜你喜欢
    • 2016-02-14
    • 2013-06-07
    • 2011-04-05
    • 1970-01-01
    • 2017-06-12
    • 2017-06-08
    • 2012-04-30
    • 2012-11-02
    相关资源
    最近更新 更多