如何在(apache 2.4)centos 7上为CodeIgniter部署启用mod_rewrite?

时间:2016-04-06 10:46:25

标签: .htaccess mod-rewrite httpd.conf codeigniter-3 apache2.4

我正在尝试找到解决我的问题的方法,关于如何在apache 2.4.6上启用mod_rewrite模块。我测试了一些我能找到的解决方案,但在我看来它不起作用。顺便说一句,我正在使用这个.htaccess配置:

 <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /sats/  <-- name of my codeigniter directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
 </IfModule>   
 <IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
 </IfModule>

我似乎无法找到启用mod重写的方法。我对centOS 7也不熟悉。我的解决方案之一是在/etc/httpd/conf/httpd.conf上将AllowOverride None更改为AllowOverride All。我似乎不明白为什么这不起作用。我还在StackOverflow上查看了一些解决方案,但它并没有解决它。因此,我所做的任何建议或事情都不胜感激。如果你找到了一些解决方案,我也想尝试一下。谢谢!

1 个答案:

答案 0 :(得分:1)

添加&#34; LoadModule rewrite_module modules / mod_rewrite.so&#34;到配置文件,写&#34; AllowOverride All&#34;对于目录并重新启动apache。