【问题标题】:Apache folder not showing upApache文件夹未显示
【发布时间】:2014-02-01 13:12:12
【问题描述】:

我在托管环境中安装 Laravel 4 应用程序时遇到问题。

我目前遇到的问题是“公共”文件夹在转到 www.eversite.be/laravel/ 时未显示在列表中,有人可以告诉我这是为什么,以及如何使其可见。

这是否与 Apache 有关,例如权限设置?不过那会很奇怪,因为我已经将文件夹更改为 777。

Apache 错误日志:

[Mon Jan 13 17:47:11 2014] [alert] [client 178.116.245.86] /sites/eversite.be/www/laravel/public/.htaccess: Options not allowed here
[Mon Jan 13 17:47:19 2014] [alert] [client 178.116.245.86] /sites/eversite.be/www/laravel/public/.htaccess: Options not allowed here
[Mon Jan 13 17:47:23 2014] [alert] [client 178.116.245.86] /sites/eversite.be/www/laravel/public/.htaccess: Options not allowed here

.htaccess 文件在 /public/

<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>

到 phpinfo() 的链接; :http://eversite.be/laravel/modrewrite.php

【问题讨论】:

  • 我也有同样的问题。你找到解决办法了吗?
  • 我删除了&lt;IfModule mod_negotiation.c&gt; Options -MultiViews &lt;/IfModule&gt; 并修复了问题。希望对您有所帮助。

标签: laravel apache .htaccess laravel-4


【解决方案1】:

在您的更新中,您的文件路径似乎不正确。如果我没记错的话,__DIR__ 可能在您正在使用的 PHP 5.2 中不可用。改为使用:

dirname(__FILE__)

【讨论】:

    【解决方案2】:

    由于打开 http://eversite.be/laravel/public 会触发 500 内部服务器错误,我会说您在 public/.htaccess 中的设置无效。您现在需要检查服务器日志以找到真正的错误消息。

    【讨论】:

    • 这些是我收到的错误:[Mon Jan 13 17:47:19 2014] [alert] [client 178.116.245.86] /sites/eversite.be/www/laravel/public/ .htaccess:此处不允许选项 [Mon Jan 13 17:47:23 2014] [alert] [client 178.116.245.86] /sites/eversite.be/www/laravel/public/.htaccess:此处不允许选项 [Mon Jan 13 17:47:26 2014] [警报] [客户端 178.116.245.86] /sites/eversite.be/www/laravel/public/.htaccess:此处不允许使用选项
    • 这是 .htaccess 文件: Options -MultiViews RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*) /$ /$1 [L,R=301] # 处理前端控制器... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L]
    • 如果您需要添加更多信息,我建议您编辑问题 - cmets 中的代码不可读。不管Options not allowed here 到底意味着什么:你不能使用Options 指令。如果是共享服务器,可以询问是否可以授予权限。
    猜你喜欢
    • 2014-09-17
    • 2019-05-22
    • 2020-08-20
    • 2018-07-16
    • 2017-03-13
    • 2018-07-13
    • 1970-01-01
    • 2015-02-26
    • 1970-01-01
    相关资源
    最近更新 更多