[ トラックバック(0) ]
Counter: 12720,
today: 1,
yesterday: 9
.htaccessの利用例
以下に設定例を書いてみました。
ご参考下さい。
(1) BASIC認証
# cat .htaccess deny from all AuthType Basic AuthName "Restricted Files" AuthUserFile /var/www/cgi-bin/pass/.htpasswd require valid-user satisfy any
※.htpasswdを生成するには2とおりある 1.コマンドベースで作成する。(コンソール,telnet,ssh) htpasswd -c /フルパス/ ユーザ名 2.PHPプログラムを利用する
(2) CGIを動作させる設定
# cat .htaccess Addtype application/x-httpd-cgi .cgi Options ExecCGI Addtype application/x-httpd-cgi .cgi
(3) 拡張子によるアクセス制御の設定
# cat .htaccess <Files ~ "\.(dat|log|csv)$"> deny from all </Files>
(4) リダイレクト設定
# cat .htaccess Redirect permanent / http://www.yahoo.co.jp
(5) Directory Indexの設定
# cat .htaccess DirectoryIndex index.html index.htm index.cgi index.php
(6) 特定ホスト(IPアドレス)によるアクセス制御の設定
★192.168.254.0/255.255.255.0は拒否する場合 # cat .htaccess order allow,deny allow from all deny from 192.168.254.0/255.255.255.0
★192.168.254.0/255.255.255.0は許可する場合 # cat .htaccess order deny,allow deny from all allow from 192.168.254.0/255.255.255.0