.htaccessでpc,携帯分岐!


.htaccessだけでpcと携帯の分岐ができる裏技。

PC用URLがhttp://hogehoge.com/pc/だとして、携帯用のINDEXファイルがあるディレクトリに以下のような.htaccessをおいておくだけです。

order deny,allow
deny from all

#-- DoCoMo --
allow from 210.153.84.0/24
allow from 210.136.161.0/24
allow from 203.138.203.0/24
allow from 61.195.223.128/27

#--- J-PHONE ---
allow from 211.8.159.128/25
allow from 210.169.193.192/26
allow from 211.127.183.0/24
allow from 210.146.60.128/25
allow from 210.134.83.22/27
allow from 211.8.49.160/27
allow from 210.134.83.32/27
allow from 210.146.7.192/26
allow from 210.151.9.160/27
allow from 210.228.189.0/24

#--- Au ---
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 219.125.149.0/24
allow from 222.7.56.0/24

#--- DDI POCKET ---
allow from 61.198.248.0/24
allow from 61.198.249.0/24
allow from 61.198.250.0/24
allow from 61.198.251.0/24
allow from 61.198.252.0/24
allow from 61.198.253.0/24
allow from 61.198.254.0/24
allow from 61.198.255.0/24

ErrorDocument 403 http://hogehoge.com/pc/

ホントに裏技だな…
推奨できませんw