關于apache的rewrite模塊、禁止某IP訪問才以及404的設置

1 rewrite模塊
1. 去掉注釋LoadModule rewrite_module modules/mod_rewrite.so
2. 修改AllowOverride為 All
<Directory "D:/www">
? AllowOverride All
?? Order allow,deny
??? Allow from all

</Directory>
3. 在www文件下建個.htaccess文件
內容如下:
RewriteEngine?? on
RewriteBase???? /
RewriteRule???? (.+)\.html$ aaa.php?id=$1 [L]


就可以通過 http://localhost/456.html 來訪問 http://localhost/aaa.php?id=456


2 禁止某IP訪問才以及404的設置
<Directory "D:/www">
Options Indexes FollowSymLinks??   //去掉Indexes可禁止目錄訪問
?? ErrorDocument 404 /missing.htm  //404錯誤顯示,missing.htm要大于512字節
?? Order allow,deny         //設置allow,deny順序
??? Allow from all
??? Deny from 111.111.111.111    //禁止IP訪問,也可用*號

</Directory>

?