Laravel 403 上传网站时禁止


Laravel 403 Forbidden when uploading site

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

-/
 -/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 中的另一个问题或设置。

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

DirectoryIndex index.php

通常,当您可以直接访问索引文件但不能不指定它时,您的 apache 配置可能没有为 index.php 指定目录索引。因此,您将获得403禁止,因为目录索引已关闭,并且它认为您没有索引文件。