我已将Laravel应用程序上传到服务器(我正在使用共享主机)。
目录结构如下:
--public_html
--laravelApp
-- app
-- bootstrap
-- public
-- vendor
-- other Laravel files
我的文档根目录指向laravelApp / public。
当我尝试使用laravelapp.com访问我的网站时,我得到500
。如果我尝试访问laravelapp.com/public或laravelapp.com/public/index.php,我会收到同样的错误。我在laravelApp的根目录中没有.htacess,只在public
文件夹中。
我想这是.htaccess的东西,但我不知道在哪里看。这是它的样子:
<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]
我看到了一些答案,我应该将所有内容(除了public
与public_html放在同一级别上),但我不明白,为什么需要。
有人可以更多地了解这一点,为什么以及如何正确地完成这项工作?是否存在一些安全问题?
答案 0 :(得分:1)
好的,解决方案是将Directory设置为我的公用文件夹,并将RewriteBase规则添加到.htaccess。还要检查你的php版本是&gt; = 5.4。