2005年05月01日

【Security】 .htaccessを利用してセキュリティを強化する

特定のIPアドレスのからのアクセスを制限

order allow,deny
allow from all
deny from xxx.xxx.xx.xx

order allow,deny … 許可・一部拒否
allow from all … とりあえず全てを許可
deny from tagindex.com … tagindex.comを拒否
deny from .net … .netを拒否
deny from 61.115. … 61.115.で始まるアドレスを拒否

特定のホストからのアクセスを拒否する指定です。
拒否したいホスト名、またはIPアドレスを、deny from に続けて記述します。

参考先:.htaccessの記述例 - TAG index

特定のリファラーからのアクセス制限

SetEnvIf Referer "^http://www\.xxxxxx\.net" ref_no
order allow,deny
allow from all
deny from env=ref_no

参考先:.htaccess実践活用術

特定のファイルからのアクセス制限

<Files ~ "\.(dat|log|csv||tsv)$">
deny from all
</Files>

参考先:futomi's CGI Cafe - .htaccess - 特定のファイルだけ守る

インデックスファイルのファイル以外へのアクセスを制限する

DirectoryIndex index.html
Options -Indexes

参考先:ミケネコの htaccess リファレンス

リダイレクトの設定(ディレクトリ構造の変更)

Redirect permanent /test/ http://www.shtml.jp/htaccess/

参考先:.htaccessでリダイレクト機能を利用する方法

エラードキュメントに任意のファイルを指定

ErrorDocument 401 /error/401-file-not-fonund.html
ErrorDocument 403 /error/403-forbidden.html
ErrorDocument 404 /error/404-authorization.html
ErrorDocument 500 /error/500-internal-server-error.html

RSSファイルでダウンロードダイアログを表示させない

AddType text/xml .xml .rdf .xsl
AddHandler server-parsed .xml .rdf .xsl

参考先:第41回(2005年5月号) 仕掛けで見せる! WEBデザインTIPS & TRICKS [ web creators]

posted by nori at 23:22| Comment(0) | TrackBack(0) | ウェブ[Web] | このブログの読者になる | 更新情報をチェックする
この記事へのコメント
コメントを書く
お名前:

メールアドレス:

ホームページアドレス:

コメント:

この記事へのトラックバックURL
http://blog.seesaa.jp/tb/3255364

この記事へのトラックバック