• LeekinDeveloper@Gmail.com

Apache开启rewrite(重写模式)

Apache开启rewrite(重写模式)


1.修改httpd.conf配置文件

在httpd.conf配置文件当中,查找到rewrite关键字,将前面的#(注释)去掉。

2.重启Apache服务器

使用命令:

1
service httpd restart

如果是wamp,那就不多复述了,很简单。

3.建立相关配置文件

在你的webroot目录下,也就是和index.php同目录下,建立一个文件名为:.htaccess的文件

然后在文件当中写入下面的XML

1
2
3
4
5
6
<Ifmodule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1[QSA,PT,L]
</Ifmodule>