首页 > 解决方案 > Laravel version 5.7 root show index of page

问题描述

Recently I am start using Laravel, and I develop a website in my local which works fine, but when I deploy it to a droplet in DigitalOcean, the root shows an index Of page.

Screen Capture is here

And when I navigate into the public folder, it shows a 500 error.

I have tried to include a few different .htaccess, which does not solve the problem. And my current .htaccess is below

DirectoryIndex index.php

Options -MultiViews

RewriteEngine On

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteRule .? %{ENV:BASE}/index.php [L]

The line "Options -MultiViews" is actually part of the .htaccess code too.

Could anyone please help me to solve this problem?

Thank you in advance.

标签: laravellaravel-5.7

解决方案


在这里查看更多

在服务器配置文件中,AllowOverride 设置为 All 还是 None?如果将其设置为 none,则所有 .htaccess 更改都将被忽略。

<Directory /var/www/YOURAPP/public>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

推荐阅读