公告版位
close

.htaccess 實用範例

以下是一些實用的 .htaccess 範例,可以不改動 php.ini 及 httpd.conf 便設定伺服器變數:

關閉 magic_quotes_gpc

# Only if you use PHP
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>

減少 Bandwidth 使用量

# Only if you use PHP
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>

變更 scripts 副檔名

AddType application/x-httpd-php .php4

以上語句會將 .php4 當成 PHP 程式編譯。

禁止 .htaccess 開放瀏覽

<files file-name>
order allow,deny
deny from all
</files>

變更預設頁面

DirectoryIndex myhome.htm index.htm index.php

自訂錯誤頁面

ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html

開放/禁止瀏覽目錄

# 禁止
Options All -Indexes
# 開啟
Options +Indexes

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 安德森 的頭像
    安德森

    安德森技術備忘板

    安德森 發表在 痞客邦 留言(0) 人氣()


    留言列表 留言列表

    發表留言
    Close

    您尚未登入,將以訪客身份留言。亦可以上方服務帳號登入留言

    請輸入暱稱 ( 最多顯示 6 個中文字元 )

    請輸入標題 ( 最多顯示 9 個中文字元 )

    請輸入內容 ( 最多 140 個中文字元 )

    reload

    請輸入左方認證碼:

    看不懂,換張圖

    請輸入驗證碼