php Laravel 收到 500 内部服务器错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24236815/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel get 500 internal server error
提问by user3483754
I had laravel project on share hosting, and my structure app is
我在共享托管上有 Laravel 项目,我的结构应用程序是
/home/username
`->fontEndApps ( my laravel apps )`
`->backendApps ( my laravel apps )`
`->public_html`
in public html I put the index.php, htaccess and admin folder, in admin folder there is index.php and htaccess
在公共 html 中,我放置了 index.php、htaccess 和 admin 文件夹,在 admin 文件夹中有 index.php 和 htaccess
backend is working fine but the front end when I try to access www.domain.com/segment1 or www.domain.com/segment1/segment2 I always got 500 internal server error, and this is my htaccess file for front end and back end
后端工作正常,但是当我尝试访问 www.domain.com/segment1 或 www.domain.com/segment1/segment2 时,前端总是出现 500 内部服务器错误,这是我用于前端和后端的 htaccess 文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options +FollowSymLinks
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
please help me to figure out this problem
请帮我解决这个问题
回答by Sanoob
Your problem is with .htaccessfile. In goDaddy they wont set RewriteBase
so you have to give it in your .htaccessfile. The complete code would like this. This worked with my laravel portfolio site
你的问题是.htaccess文件。在 goDaddy 中,它们不会设置,RewriteBase
因此您必须在.htaccess文件中提供它。完整的代码是这样的。这适用于我的 Laravel 投资组合网站
<Limit GET POST PUT DELETE>
#For REST support
Allow from all
</Limit>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase / # <------------ This one you missed
#Just to redirect to www.site.com when only site.com comes
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST} [R=301,L]
#end of codes
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
回答by ecairol
After a couple of hours searching, this solved the problem:
经过几个小时的搜索,这解决了问题:
Make sure index.phpwithin /public_html has 644permissions (mine was 664 and that was the cause of the Internal Server Error).
确保/public_html 中的index.php具有644权限(我的是 664,这是内部服务器错误的原因)。
回答by Manic Depression
I must comment this lines in .htaccess and it works:
我必须在 .htaccess 中评论这一行,它可以工作:
#<IfModule mod_negotiation.c>
# Options -MultiViews
#</IfModule>
回答by Abdelsalam Shahlol
Make sure you have the Vendorfolder uploaded in the server it can cause 500 error.
确保您已将Vendor文件夹上传到服务器中,这可能会导致 500 错误。