【问题标题】:Laravel 403 Forbidden when uploading siteLaravel 403 上传网站时被禁止
【发布时间】:2015-01-14 03:18:36
【问题描述】:

我已将我的网站上传到 1and1(对于不是我选择的客户),我不得不将网站放在根目录下的子文件夹中,所以基本上:

-/
 -/subfolder
   -/app
   /vendor
   /public
   /everything else laravel has

并且我成功地编辑了域以指向公用文件夹。

但是,当我尝试转到 www.website.com 时,它会返回 403 禁止错误。我可以零问题转到其他页面www.website.com/coolstuff。我什至可以通过输入www.website.com/index.php 来打开主页

所以,我认为这是我的 .htaccess 文件,我根据其他人与 1and1 和 laravel 相关的问题对其进行了编辑,但我仍然遇到同样的问题。

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

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
</IfModule>

所以不确定是否有其他方法可以编辑它以使其正常工作。或者,如果它可能是 1and1 中的另一个问题或设置。

【问题讨论】:

  • 确保目录有读权限。

标签: php .htaccess laravel


【解决方案1】:

把它放在你的 .htaccess 文件的顶部,看看它是如何为你工作的。

DirectoryIndex index.php

通常当你可以直接访问索引文件但你不能不指定它时,你的 apache 配置可能没有为 index.php 指定目录索引。所以你会得到一个 403 禁止,因为目录索引被关闭并且它认为你没有索引文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-10
    • 2016-03-08
    • 1970-01-01
    • 2017-10-03
    相关资源
    最近更新 更多