操作步骤如下:
1:进入apache目录的conf目录
2:打开httpd.conf
3:找到#LoadModule rewrite_module modules/mod_rewrite.so
然后把前面的#
去掉
4:找到所有的AllowOverride
配置项,把所有的None
都修改为All
5:在网站根目录下面新建一个 .htaccess 文件
(什么?这个文件不会添加?先新建一个txt,然后另存为 .htaccess文件就行),输入一下内容
[plain] view plain copy
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
6:重启apache
原文地址 http://blog.csdn.net/buyueliuying/article/details/49962245
1.上面的内容有误
[plain] view plain copy
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
该配置倒数第二行,将 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
改成 RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
index.php
后面少了一个?
字符
纠正者:http://www.fecshop.com/topic/514 9楼评论
2.另外,需要加 RewriteBase /
,否则将会出现500
错误
去搜索,有nginx的贴