由于httpd没有在编译时把重写模块编译进去 ,因此为了配置 重写规则,先通过
# /usr/local/apache/bin/apxs -c mod_rewrite.c //apxs应指定绝对路径,在你当前正在使用apache的bin目录里
# /usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
-a表示自动在你的httpd配置文件中使用重新模块。
因为是动态加载,所以,我们/usr/local/apache/bin/httpd -l 发现根本木有 mod_rewrite.c,因此下规则的时候不能使用
<if Module mod_rewrite.c>这种方式 ,因此使用下面的方式。
<If Module rewrite_module>
但是很悲剧的是 ,上面那个语句判断应该已久是 没有为TRUE,因此,mode_rewrite还是没有配置对。而且很诡异的是,我们写一个phpinfo发现 ,mod_rewire模块是load了的。没有办法,只有通过一下方式解决咯。
<Directory />
Options Includes FollowSymLinksAllowOverride All
#<IfModule rewrite_module>
RewriteBase /
RewriteEngine on
#RewriteLogLevel 9
#RewriteLog logs/rewrite.log
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
#</IfModule>
</Directory>