|
User #132410 2319 posts
Whirlpool Forums Addict
|
Hi guys I need a bit of help with blocking certain web browsers from accessing my website. I tried doing it via .htaccess – It always leads to an internal server error either because I've entered an incorrect syntax or for any other reason. Basically I want my website to be accessible only by mobile phone users. I've tried blocking every web browser except MobileSafari as a test but this didn't seem to work. I went to a website with a database with all the user-agent names so I don't think I managed to get it wrong when entering it into my htaccess file. Also, using this method I will obviously not be able to host an error page on the same server since the user-agent would be blocked, causing a redirect loop so that is an inconvenience I'm looking for other options though, since this method would also block search engines? What else can I do to keep any PC users out of my website and hopefully allow search engines? Thanks for reading. Sorry if it's confusing..it's late (..overused excuse these days?) |
reference: whrl.pl/RccCky
posted 2010-Mar-14, 12am AEST
edited 2010-Mar-14, 12am AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
I tried doing it via .htaccess Have you tried it like this: |
reference: whrl.pl/RccCqD
posted 2010-Mar-14, 1am AEST
|
|
User #27826 2325 posts
Whirlpool Forums Addict
|
Why do you neeed to block everyone except mobile users? Maybe what you want as an end result can be gotten at another way. It's better design to look for what you do want. As opposed to what you don't. |
reference: whrl.pl/RccHlz
posted 2010-Mar-15, 1pm AEST
|
|
User #326586 522 posts
Whirlpool Enthusiast
|
User agents can be easily changed. In fact, IE and Opera mini both give me the option to "act" as a dektop pc or a phone. |
reference: whrl.pl/RccHBb
posted 2010-Mar-15, 2pm AEST
|
|
User #132410 2319 posts
Whirlpool Forums Addict
|
Have you tried it like this: Thanks for that, I think I've tried many things along those lines it's only lead to problems though. I think another issue with blocking user agents via .htaccess is the website slows down quite a bit. It also blocks out search engines and whatnot, and whenever I tried it I could never get perfect results. (It would block some browsers, give Error 500 on others, and sometimes 500 on mobile phones too) Why do you neeed to block everyone except mobile users? The website is intended for mobile phone users only. User agents can be easily changed. In fact, IE and Opera mini both give me the option to "act" as a dektop pc or a phone. Yeah, it's not a 100% solution but I think it would help me a bit. Is there any other way I could go about this? I'm thinking of converting the entire website to wordpress and using a phone plugin. And if you visit the website via PC it would just lead to a static page. |
reference: whrl.pl/RccVRM
posted 2010-Mar-18, 12pm AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
Is there any other way I could go about this? Why can't you just simply...ignore...anyone who visits the site NOT using a mobile device? Pretend the problem isn't there ;) |
reference: whrl.pl/RccWcm
posted 2010-Mar-18, 1pm AEST
|
|
User #132410 2319 posts
Whirlpool Forums Addict
|
Because they would be using bandwidth that could be used elsewhere. And if someone were to access it via PC, it would be very easy for my files to be leeched |
reference: whrl.pl/RccXEH
posted 2010-Mar-18, 6pm AEST
|
|
User #210173 1039 posts
Whirlpool Enthusiast
|
Hmm sounds like youre mixing platforms, i.e. handheld device vs desktop/pc. http://en.wikipedia.org/wiki/Mobile_development Unless you can be more specific with how your files might be leeched, someone else might be able to provide methods around tightening security around those files, but that negates your issue around bandwidth. If this is anything half serious then this whole thing feels pretty slap chop anyway... I dont know of any other mobile dev sites but im sure there are tonnes out there, but to get the ball rolling. Interesting topic, would like to know how it turns out. |
reference: whrl.pl/RccXPA
posted 2010-Mar-18, 7pm AEST
|
|
User #132410 2319 posts
Whirlpool Forums Addict
|
I've developed and designed the website and it's running exactly how I want it to, so that's not an issue. Like I said, it is for mobile phone users only and I do not plan on making it work for PC users, in any way. The website is mobile themed. Meaning if you were to visit from an iPhone, you would get the "iPhone look" – The same goes for BlackBerry users. And I'm working on the other other mobile platforms. Since it is not intended for devices other than mobile phones, in any way, means that giving PC users access to it leads to a waste of bandwidth. Links to my files are spread around, files get hotlinked etc. (Videos, audio and images) and I'm already seeing this happen. I've taken some measures against my files being hotlinked though, and bandwidth usage has decreased a bit. I think I can write something up quickly in php and see how that goes. Would be much easier than .htaccess and maybe more flexibility, with allowing search engines in etc. Maybe instead of blocking browser user-agents I can block the users operating system. |
reference: whrl.pl/RccYRN
posted 2010-Mar-19, 12am AEST
edited 2010-Mar-19, 12am AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
I can block the users operating system. lol! This is the first time I've come across someone trying to keep their site away from people with a computer. I concur with the other fellow – this IS quite intriguing. Let us know how you go about it. the htaccess seems like your best bet imho, you just need to get the syntax right. |
reference: whrl.pl/RccYVN
posted 2010-Mar-19, 12am AEST
|
|
User #132410 2319 posts
Whirlpool Forums Addict
|
Well I could have a separate website for PC users – but right now I don't have the resources for it. I'm already pushing out 200GB~ each day as it is I think the .htaccess method is very limited with allowing search engines into the website, simple php redirect could work pretty well. I'll have to try both methods for a few days and see how they go Will report back then |
reference: whrl.pl/RccZB1
posted 2010-Mar-19, 9am AEST
|
|
User #152097 325 posts
Forum Regular
|
What's the error code? 500? PS:it is possible to block clients based on the user-agent string. -3 |
reference: whrl.pl/Rcc4CG
posted 2010-Mar-20, 3pm AEST
|
|
User #77347 3956 posts
Whirlpool Forums Addict
|
If your site is being served by php, perhaps instead of using .htaccess for blocking you could use phpbrowscap and check is the ismobile (?) attribute and take action based on that. |
reference: whrl.pl/Rcc6Zb
posted 2010-Mar-21, 12pm AEST
|