You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Erwien Samantha Y <ap...@cosinus.sederhana.or.id> on 2004/09/02 03:51:42 UTC

[users@httpd] Again About ReWriting URL

Hi,

I like to Deny all request to admin.html  with No REFERER "AND" No USER_AGENT 
info , but if user only have one of info REFERER "OR" USER_AGENT he/she still 
have posibility to access admin.html , 
Any can help me how to define the condition ??

Thanks,

Erwien 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Again About ReWriting URL

Posted by Robert Andersson <ro...@profundis.nu>.
Erwien Samantha Y wrote:
> Can you tell me what the meaning  "!.+" ?
> RewriteCond %{HTTP_REFERER}%{HTTP_USER_AGENT} !.+

Dot (.) matches any character, the plus sign (+) matches one or more
instances of the previous. So, the expression ".+" matches anything but an
empty string. Exclamation mark (!) negates the test, thus the condition is
"if the string is empty". Having said that, I realize that the expression
"^$" would make more sense :)

> this the real condition that  i want to do ..
>
> Deny this request because there're no INFO about HTTP_REFERER
> and HTTP_USER_AGENT

Does the rule seem to work? Are you sure it is only "admin.html" you want to
protect this way, and not other URIs it might link to?

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Again About ReWriting URL

Posted by Erwien Samantha Y <ap...@cosinus.sederhana.or.id>.
Hi Robert ,

Can you tell me what the meaning  "!.+" ?
RewriteCond %{HTTP_REFERER}%{HTTP_USER_AGENT} !.+

this the real condition that  i want to do ..

Deny this request because there're no INFO about HTTP_REFERER and 
HTTP_USER_AGENT
xxx.xxx.xxx.xx - - [03/Sep/2004:08:14:17 +0700] "GET /admin.html HTTP/1.0" 200 
76620 "-" "-" 

But we can still accept if there any info about HTTP_REFERER or 
HTTP_USER_AGENT
xxx.xxx.xx.xx - - [03/Sep/2004:08:16:15 +0700] "GET /admin.html HTTP/1.1" 200 
13085 "-" "Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54  
[en]"

thanks.

Erwien 



On Thursday 02 September 2004 07:55 am, Robert Andersson wrote:
> Erwien Samantha Y wrote:
> > I like to Deny all request to admin.html  with No REFERER "AND" No
> > USER_AGENT info , but if user only have one of info REFERER "OR"
> > USER_AGENT he/she still have posibility to access admin.html ,
> > Any can help me how to define the condition ??
>
> Hmm, well, problably yes:
>
> RewriteCond %{HTTP_REFERER}%{HTTP_USER_AGENT} !.+
> RewriteRule admin\.html - [F]
>
> But I wonder if that really is what you want...
>
> Regards,
> Robert Andersson
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Again About ReWriting URL

Posted by Robert Andersson <ro...@profundis.nu>.
Erwien Samantha Y wrote:
> I like to Deny all request to admin.html  with No REFERER "AND" No
> USER_AGENT info , but if user only have one of info REFERER "OR"
> USER_AGENT he/she still have posibility to access admin.html , 
> Any can help me how to define the condition ??

Hmm, well, problably yes:

RewriteCond %{HTTP_REFERER}%{HTTP_USER_AGENT} !.+
RewriteRule admin\.html - [F]

But I wonder if that really is what you want...

Regards,
Robert Andersson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org