Apache - 拒絕外部要求~localhost only

前幾天發現我的wamp的首頁............顯示一推做過的網站........

只要我一打開= =...............人家從我IP直接就可以看我做過的網站耶.........

突然覺得這樣不行~~~~所以我就先用PHP把她Deny掉

PHP方法~
在index檔案中上面加入這段程式
if($_SERVER['HTTP_HOST'] != 'localhost')
{
die("FUCK YOU");
}

不用PHP也行~~~可以用Apache


Apache方法~
在.htaccess中打這段語法
Allow from 127.0.0.1
Allow from localhost
Deny from all

-----------------------------------------------------------------------------------------------
PHP的方法結果是
FUCK YOU

Apache方法結果是

Forbidden

You don't have permission to access / on this server.

沒有留言: