laravel - 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.
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.
解决方案
在这里查看更多
在服务器配置文件中,AllowOverride 设置为 All 还是 None?如果将其设置为 none,则所有 .htaccess 更改都将被忽略。
<Directory /var/www/YOURAPP/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
推荐阅读
- c++ - 条件变量通知和等待
- r - R韩语正则表达式
- python - 如何让这个循环以命令开始
- time-complexity - Euclid算法的时间复杂度减法
- google-apps-script - 连接工作表中的一系列单元格后的额外逗号
- javascript - 我的 JavaScript 不能用于我的 MVC 项目
- c++ - 有没有办法让构造函数自动理解参数类型?
- c++ - C++ 标准中的 [dcl.fct.def.general]/1 可能存在问题
- google-chrome - 谷歌浏览器是否为每个 HTTP 请求创建一个新的套接字?
- python - 如何检查地理位置是否在半径范围内?