apache 2.4.htaccess内部服务器错误(.htaccess不工作)

apache 2.4.htaccess内部服务器错误(.htaccess不工作),apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我想使用.htaccess,但如果我尝试将上的RewriteEngine添加到文件中,并且当我刷新网页时,我在apache 2.4上得到内部服务器错误,我还添加到/etc/apache2/apache2.conf: <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> 选项索引跟随符号链接 允

我想使用.htaccess,但如果我尝试将
上的RewriteEngine添加到文件中,并且当我刷新网页时,我在apache 2.4上得到
内部服务器错误
,我还添加到/etc/apache2/apache2.conf:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

选项索引跟随符号链接
允许超越所有
要求所有授权

发生错误的原因?

。你检查过apache错误日志了吗?可能mod_rewrite未启用?在日志中,我发现
无效的命令“RewriteEngine”,可能拼写错误或由未包含在服务器配置中的模块定义,肯定是重复的。以root用户身份运行
a2enmod rewrite
,然后运行
apachectl restart
。。你检查过apache错误日志了吗?可能mod_rewrite未启用?在日志中,我发现
无效的命令“RewriteEngine”,可能拼写错误或由未包含在服务器配置中的模块定义,肯定是重复的。以root用户身份运行
a2enmod rewrite
,然后运行
apachectl restart