Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-06-2013, 11:55 PM   PM User | #1
sonny
Regular Coder

 
sonny's Avatar
 
Join Date: Apr 2008
Location: United States
Posts: 567
Thanks: 88
Thanked 0 Times in 0 Posts
sonny can only hope to improve
user agent condition (no match)

Hi
Trying to create a condition where if the user agent string does not match give a forbidden
anyone know why my code does not work?

Updated works now
Code:
RewriteCond %{HTTP_USER_AGENT} !^user-agent*
RewriteRule .* - [F,L]
Thanks
Sonny

Last edited by sonny; 02-07-2013 at 02:37 AM..
sonny is offline   Reply With Quote
Old 02-07-2013, 01:39 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Why are you trying to block visitors based on their useragent? Anyone would be easily aboe to get around the block simply by editing their useragent to match what you want it to be. Some browsers even allow the useragent to be set to different values for different sites. All of the popular browsers (except possibly for Chrome) allow the browser owner to easily set the useragent to any value they like.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 02-07-2013, 02:34 AM   PM User | #3
sonny
Regular Coder

 
sonny's Avatar
 
Join Date: Apr 2008
Location: United States
Posts: 567
Thanks: 88
Thanked 0 Times in 0 Posts
sonny can only hope to improve
Quote:
Originally Posted by felgall View Post
Why are you trying to block visitors based on their useragent? Anyone would be easily aboe to get around the block simply by editing their useragent to match what you want it to be. Some browsers even allow the useragent to be set to different values for different sites. All of the popular browsers (except possibly for Chrome) allow the browser owner to easily set the useragent to any value they like.
I'm not looking to block users based on user agent, I am allowing in certain cases as part of a wider approach etc I figured it out very easy just need to escape properly and format like !^...*
sonny is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:28 AM.


Advertisement
Log in to turn off these ads.