「.htaccess」を使って、PCからのケータイサイト閲覧を拒否する方法

ケータイ専用のサイトで、PCからのアクセスを拒否する方法はいろいろあります。僕は基本的に個人のサイトはPCからでも閲覧できるようにしていますが、場合によっては端末ごとにアクセスさせるページをCGIで振り分けたりもしています。
で、今回は「.htaccess」を使ってケータイ以外のアクセスを拒否する方法。
DoCoMo、au(EZweb)、Vodafone(SoftBank)のIPを参照し、そこからのアクセスしか認めないという設定にする。これを.htaccessというファイル名で、ケータイサイトのディレクトリに置く、と。
ま、.htaccessが設置できないレンタルサーバーとかだったらこれはできないですけどね。

で、一応これがリスト。


# Mobile IP List
order deny,allow
deny from all
# DoCoMo (Sept. 27, 2006)
allow from 210.153.84.0/24
allow from 210.136.161.0/24
allow from 210.153.86.0/24
allow from 210.153.86.0/24
allow from 210.153.87.0/24
# Vodafone/SoftBank (Jun. 2, 2006)
allow from 210.146.7.192/26
allow from 210.146.60.192/26
allow from 210.151.9.128/26
allow from 210.169.176.0/24
allow from 210.175.1.128/25
allow from 210.228.189.0/24
allow from 211.8.159.128/25
allow from 202.179.204.0/24
# AU/TUKA (Aug. 14, 2006)
allow from 210.169.40.0/24
allow from 210.196.3.192/26
allow from 210.196.5.192/26
allow from 210.230.128.0/24
allow from 210.230.141.192/26
allow from 210.234.105.32/29
allow from 210.234.108.64/26
allow from 210.251.1.192/26
allow from 210.251.2.0/27
allow from 211.5.1.0/24
allow from 211.5.2.128/25
allow from 211.5.7.0/24
allow from 218.222.1.0/24
allow from 61.117.0.0/24
allow from 61.117.1.0/24
allow from 61.117.2.0/26
allow from 61.202.3.0/24
allow from 219.108.158.0/26
allow from 219.125.148.0/24
allow from 222.5.63.0/24
allow from 222.7.56.0/24
allow from 222.5.62.128/25
allow from 222.7.57.0/24
allow from 59.135.38.128/25
by t0maki | 2006-10-02 23:59 | アート>待受画像 | Comments(0)