修改 httpd.conf 中有關 User 網頁設定的部份:
<Directory /home/*/public_html>
Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
將其中之
AllowOverride None
改為
AllowOverride All
然後重新啟動Apache。
--------------------------
User只要建立$HOME/public_html/.htaccess檔案,並寫入一行:
Options -Indexes
--------------------------
http://www.lab.mlc.edu.tw/~lulu/
http://www.lab.mlc.edu.tw/~tim/
這兩個網址都沒有 index.html
lulu沒有建立.htaccess,而tim則建立了.htaccess。
上面的例子是User的網站設定,系統主網站的設定方式可比照辦理。
Order deny,allow Deny from all Allow from .edu.tw先deny再allow,把全部的連線都deny掉之後,才allow部份的連線。
這裡除了使用FQDN方式來設定,您也可以使用IP的方式,例如:
Allow from 163.19.
修改過 .htaccess 檔案後,不需要重新啟動 Apache ,設定值可立即生效。