1、 修改文件:Apache2.X.X\conf\httpd.conf
找到这一行# LoadModule rewrite_module modules/mod_rewrite.so
将前面的#删除
2、 查找所有的AllowOverride,将后面的none修改为ALL
<Directory />
Options FollowSymLinks
AllowOverride ALL //就是这一行
Order deny,allow
Allow from all
Satisfy all
</Directory>
3、 重新启动Apache
4、 再配上针对于你的程序设计的.htaccess文件,就可以静态化网页。
5、 .htaccess配置文件使用如下:
# 将RewriteEngine 模式打开
RewriteEngine On
# 修改以下语句中的/Demo 为你需要改写目录地址,如果程序放在根目录中,请将/Demo 修改为/
RewriteBase /
# Rewrite 系统规则请勿修改
RewriteRule ^index\.html$ index1.php
说明:上面的代码就是让网站的index1.php的地址改写为index.html
index1.php文件如下。
<?php
phpinfo();
?>
6、 效果图: