.htaccessメモ


該当ファイルへのアクセスをリダイレクト

RedirectMatch 301 /test http://yahoo.co.jp

UAに応じてリダイレクト

RewriteCond %{HTTP_USER_AGENT} !(iPod|iPhone|iPad|Android)
RewriteRule ^sp/(.*)$ / [R=301,L]

RewriteCond %{HTTP_USER_AGENT} (iPhone|iPod|iPad|Android) [NC]
RewriteRule ^$ /sp/ [R=301,L]

RewriteCond %{HTTP_USER_AGENT} !Twitterbot [NC]
RewriteRule ^$ /pc/ [R=301,L]

FBやmixiのクローラを許可

order deny,allow
deny from all

Allow from env=fb_crawler
Allow from env=fb_crawler2
Allow from env=mixi_crawler

basic認証

AuthUserFile /home/hogehoge/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password”
AuthType Basic
require valid-user