学新通技术网

解决Additionally, a 500 Internal Server Error error was encountered while trying错误

Luke 15806 1
解决Additionally, a 500 Internal Server Error error was encountered while trying错误

前言

打开网站,页面提示Additionally, a 500 Internal Server Error error was encountered while trying,困扰了我一上午,网上查询了一编,都没找到一个合理的解决方法,现在解决了,我将方      法发表在我的博客,供大家讨论

完整的错误提示是

        Internal Server Error

        The server encountered an internal error or misconfiguration and was unable to complete your request.

        Please contact the server administrator, wuliqiang_aa@163.com and inform them of the time the error occurred, and anything you might have done that may have caused the         error.

        More information about this error may be available in the server error log.

        Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

 

原因

出现这个的原因是因为我要设置.htaccess文件,要重写URL,同时要配置404 500错误页面,使用

ErrorDocument 404 /html/404.html
ErrorDocument 500 /html/500.html

进行配置,配置好后发现网站打不开,出现500错误。

解决方法如下

        在.htaccess文件里面的写法

        原:错误配置

Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ website/$1 [QSA,PT,L]

        新:正确配置

Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ website/$1 [QSA,PT,L]

原因:在.htaccess文件的Rewrite的规则里面新加两段话

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]  

加上这两句话后则解决问题。

结论

出现 Additionally, a 500 Internal Server Error error was encountered while trying 的具体原因是因为:重写重定向限制

本文出至:学新通技术网

标签: