Laravel 403 上传站点时被禁止

Laravel 403 Forbidden when uploading site

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

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

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

但是,当我尝试转到 www.website.com 时,它 returns 出现了 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 ^(.*)/$ / [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 中的另一个问题或设置。

将它放在您的 .htaccess 文件的顶部,看看它如何为您工作。

DirectoryIndex index.php

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