No.2ベストアンサー
- 回答日時:
User-Agentで絞るとか。
SetEnvIfNoCase User-Agent "Windows" ua_os=windows
SetEnvIfNoCase User-Agent "Mac.*OS" ua_os=macos
SetEnvIfNoCase User-Agent "Linux" ua_os=linux
RewriteEngine On
RewriteCond %{ENV:ua_os} windows [OR]
RewriteCond %{ENV:ua_os} macos [OR]
RewriteCond %{ENV:ua_os} linux
RewriteRule ^(.*)$ - [F,L]
No.3
- 回答日時:
スマートフォンとそれ以外の区別ならば、HTTP ヘッダ部の User-Agent (UA) を読み取ることで(たぶん)判別できます。
以下の説明によると、特定の文字列 “Mobi” が含まれていればモバイル端末だそうです。
参考) UA 文字列を用いたブラウザーの判定
https://developer.mozilla.org/ja/docs/Web/HTTP/B …
htaccess で検知させるならば、以下のようにすればよいでしょう
RewriteCond %{HTTP_USER_AGENT} !(Mobi)
RewriteRule ".*" "-" [F,L]
参考) htaccess の条件の書き方
https://httpd.apache.org/docs/2.4/mod/mod_rewrit …
デベロッパーとは開発用のエミュレーターのことでしょうか?
それならば UA を完全に偽装してくるので識別はできません。
あきらめましょう。
余談ではありますが
このようなやり方は一般に良くないとされていますので、できれば別の手段を探すなり、そもそもの仕様を再検討することをお勧めします。
No.1
- 回答日時:
UAで禁止すればいい
https://htaccess.cman.jp/explain/access_useragen …
ただ、MACOSとIOSの区別がつかないかもしれんな
# AccessControl UserAgent
# OS
SetEnvIfNoCase User-Agent "Windows" ua_os=windows
SetEnvIfNoCase User-Agent "Mac.*OS" ua_os=macos
SetEnvIfNoCase User-Agent "Linux" ua_os=linux
SetEnvIfNoCase User-Agent "SunOS" ua_os=linux
SetEnvIfNoCase User-Agent "BSD" ua_os=linux
SetEnvIfNoCase User-Agent "Android" ua_os=android
SetEnvIfNoCase User-Agent "Sleipnir" ua_os=sleipnir
SetEnvIfNoCase User-Agent "Nintendo" ua_os=game
SetEnvIfNoCase User-Agent "PlayStation" ua_os=game
# DEVICE
SetEnvIfNoCase User-Agent "iPhone" ua_device=smart
SetEnvIfNoCase User-Agent "iPod" ua_device=smart
SetEnvIfNoCase User-Agent "Android.*Mobi" ua_device=smart
SetEnvIfNoCase User-Agent "Windows Phone" ua_device=smart
SetEnvIfNoCase User-Agent "Mobi.*Firefox" ua_device=smart
SetEnvIfNoCase User-Agent "(Nexus 4|Nexus 5|Nexus 6)" ua_device=smart
SetEnvIfNoCase User-Agent "BlackBerry" ua_device=smart
SetEnvIfNoCase User-Agent "iPad" ua_device=tablet
SetEnvIfNoCase User-Agent "Android.*Tablet" ua_device=tablet
SetEnvIfNoCase User-Agent "Windows.*Touch" ua_device=tablet
SetEnvIfNoCase User-Agent "Tablet.*Firefox" ua_device=tablet
SetEnvIfNoCase User-Agent "(Kindle|Silk)" ua_device=tablet
SetEnvIfNoCase User-Agent "(Nexus 7|Nexus 9|Nexus 10)" ua_device=tablet
SetEnvIfNoCase User-Agent "^DoCoMo" ua_device=phone
SetEnvIfNoCase User-Agent "UP.Browser" ua_device=phone
SetEnvIfNoCase User-Agent "SoftBank" ua_device=phone
SetEnvIfNoCase User-Agent "^J-PHONE" ua_device=phone
SetEnvIfNoCase User-Agent "MOT-" ua_device=phone
SetEnvIfNoCase User-Agent "WILLCOM" ua_device=phone
SetEnvIfNoCase User-Agent "^emobile" ua_device=phone
RewriteEngine On
RewriteCond %{ENV:ua_device} tablet [OR]
RewriteCond %{ENV:ua_os} windows [OR]
RewriteCond %{ENV:ua_os} linux [OR]
RewriteCond %{ENV:ua_os} game [OR]
RewriteCond %{ENV:ua_os} phone
RewriteRule ^(.*)$ - [F,L]
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
- ・ゆるやかでぃべーと タイムマシンを破壊すべきか。
- ・歩いた自慢大会
- ・許せない心理テスト
- ・字面がカッコいい英単語
- ・これ何て呼びますか Part2
- ・人生で一番思い出に残ってる靴
- ・ゆるやかでぃべーと すべての高校生はアルバイトをするべきだ。
- ・初めて自分の家と他人の家が違う、と意識した時
- ・単二電池
- ・チョコミントアイス
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
RADWIMPSの 早口な歌わかるだけ...
-
懐かしい「フォークグループ」...
-
今はなき、あの歌声に
-
90年式NSR50にボア用チャンバー...
-
みなさんの好きな歌は何ですか??
-
アルペジオ教えてください。
-
誰と誰の対談が聞きたい
-
生理的に受け付けない曲
-
原曲を超えたカバー曲(邦楽)
-
兵庫県の西脇市か多可町で、月...
-
ゴルフで世界最高スコアは?
-
初恋の人と同窓会で再会、感想は?
-
どうして男性は女性の顔をじろ...
-
イケメンって 少なくないですか...
-
変な質問で申し訳ありません。 ...
-
身長150cmですが、全身写真で顔...
-
ちあきなおみ長身のイメージあ...
-
イケメンは話しかけにくいですか?
-
既婚おばさんでもイケメンと話...
-
なぜイケメンで頭が良い人は少...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
小学校のとき好きだった人と結...
-
初恋の人と同窓会で再会、感想は?
-
RADWIMPSの 早口な歌わかるだけ...
-
大き過ぎるスリッパを小さくす...
-
誰のアメージンググレースがい...
-
男で太い声と細い声のアーティ...
-
歌番組を見てる時に隣で一緒に...
-
ラルクが嫌いな人に質問です
-
本田美奈子さんは美人?顔のレ...
-
女性でV系嫌い
-
【男性だけにお聞きします】mis...
-
あなたの、おすすめは、なんで...
-
初恋の人の顔を思い出してくだ...
-
米津玄師のCDは何故あんなに売...
-
五月雨は緑色…
-
好きな輸入食材ってなんですか?
-
色々な初体験の年齢を教えてく...
-
今はなき、あの歌声に
-
曲提供者による、セルフカバー...
-
懐かしい「フォークグループ」...
おすすめ情報