Re: 網頁被看光光了
> 請爬文 【請問】如何讓網頁不會顯示目錄內的檔案??
綜合爬文結果,重點有4:
1.)刪除indexes即可,但記得重新啟動apache
2.) chmod o-r 目錄/ 就好啦
3.)不想改或無權限改設定檔就將一個空白檔存成 index 檔就好了嗎
4.)在 /home/www 下新增 .htaccess
vi .htaccess
Options -Indexes
目前實驗結果就只設空的 index.html 才得以達成
既然以空的 index.html 就能達成,那理應在 http.conf 裡就能控制選項才對
以下是我的操作
一、vi /usr/local/etc/apache2/httpd.conf
把原來的 Options Indexes FollowSymLinks 改為
......
Options FollowSymLinks
或Options SymLinksifOwnerMatch
或Options ExecCGI
或Options MultiViews
或Options All
或Options None
或Options All -Indexes
.......
# /usr/local/etc/rc.d/apache2.sh restart 重啟動
情況依舊
二、在 /usr/local/www/ 下建立 .htaccess
或在/usr/local/www/data 下建立 .htaccess
# /usr/local/etc/rc.d/apache2.sh restart 重啟動
情況依舊
三、如果在 user 下建一空白的 index.html 就能達成讓網頁不會顯示目錄內的檔案
四、前 2.) chmod o-r 目錄/ 不想更改
五、http.conf 應該可以設定,很不信邪!
討論串 (同標題文章)
FreeBSD 近期熱門文章
PTT數位生活區 即時熱門文章