由于.htaccess导致500内部服务器错误

时间:2018-04-19 17:30:27

标签: .htaccess

所以我收到了这个错误,问题出现在.htaccess文件中。 这是代码:

DirectoryIndex index.php
Options -MultiViews -Indexes +FollowSymLinks

<IfDefine APACHE2>
    AcceptPathInfo On
</IfDefine>

<IfModule rewrite_module>
    RewriteEngine On
    RewriteBase /

    #RewriteCond %{HTTPS} !on
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # RewriteRule (.layout1\.htm) templates$1 [QSA,L]
    RewriteRule ^$ index.php?/ [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php?/$1 [QSA,L]
</IfModule>

那么有人可以为这个问题提出解决方案吗?谢谢!

1 个答案:

答案 0 :(得分:1)

请检查错误日志,转到目录cd / var / log / apache2 输入ls-> enter。 如果您遇到错误的.htaccess:无效的comman $

比通过运行命令解决了这个问题。

sudo a2enmod rewrite && sudo service apache2 restart
相关问题