尝试实时访问网站时出现内部错误

时间:2018-12-09 22:39:47

标签: .htaccess codeigniter-3

出现以下错误

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

Please contact the server administrator at webmaster@api.example.com.au to inform them of the time this error occurred, and the actions you performed just before this 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,数据库文件,配置文件。

.htaccess文件包含以下代码

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
Options -Indexes

Codeigniter项目位于api.websiteName.com文件夹中,而不位于public_html中,如果我删除index.php和htccess文件并上传“ index.html”文件用于测试目的,则进行索引。 html可以正常工作,但是当我上载index.php和.htaccess文件回来时,它说内部服务器错误500,对于同一问题有很多答案,我遵循了答案并确实更新了.htaccess文件,但没有任何效果。文件夹权限设置为755,但仍然出现相同的错误。任何帮助将不胜感激。

PHP版本高于5.6

1 个答案:

答案 0 :(得分:0)

您可以在代码中尝试使用此.htaccess文件。

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
<IfModule mod_headers.c>    
      Header add Access-Control-Allow-Origin "*" 
</IfModule>
<IfModule mod_env.c>
    SetEnv CI_ENV development
</IfModule>

我希望它能对您有所帮助。