Laravel 403上传网站时禁止使用

I have uploaded my site to 1and1 (for a client not my choice) and I had to put the website in a subfolder off of root so basically:

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

and I successfully edited the domain to point to the public folder.

However, when I try to go to www.website.com it returns an 403 forbidden error. I can go to other pages www.website.com/coolstuff with zero issues. I can even pull up the home page by typing www.website.com/index.php

So, I thought it was my .htaccess file and I edited it according to other peoples issues related to 1and1 and laravel and I still get the same problem.

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

So not sure of another way to edit this to get it to work. Or, if it could be another issue or setting within 1and1.

dongnaizao8039
dongnaizao8039 确保该目录具有读取权限。
接近 6 年之前 回复

1个回答



将它放在.htaccess文件的顶部,看看它是如何工作的。</ p>

  DirectoryIndex index.php 
</ code> </ pre>

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

展开原文

原文

Put this at the top of your .htaccess file and see how it works for you.

DirectoryIndex index.php

Typically when you can access the index file directly but you can't without specifying it, your apache config may not have a directory index specified for index.php. So you will get a 403 forbidden because directory indexing is turned off and it thinks you don't have an index file.

dousao2186
dousao2186 这似乎有效。 谢谢!
接近 6 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐