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
# Rewrite 系統規則
RewriteRule ^index\.html$ index1.php
說明:上面的代碼就是讓網站的index1.php的地址改寫爲index.html
index1.php文件範例如下。
1. <?php
2. phpinfo();
3. ?>