為避免訪客瀏覽非預設可瀏覽的檔案及資料夾內容,可使用 .htaccess 設定禁止瀏覽的檔案及資料夾 ( 資料夾內檔案仍可存取 )。

設定範例內容如下:

RewriteEngine on

# forbidden files
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule \.(md|gitignore|gitmodules) - [F]

# forbidden directories
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .git|img|css|js - [F]
arrow
arrow
    創作者介紹
    創作者 ChouAndy 的頭像
    ChouAndy

    ChouAndy 的學習筆記

    ChouAndy 發表在 痞客邦 留言(0) 人氣()