Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule not working

         

keyplyr

9:24 am on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This UA is supposed to be allowed to get the robots.txt -or- my custom 403 error page, but it could not. Why?

from .htaccess


RewriteCond %{HTTP_USER_AGENT} ^(sit*ch*ck)?.?int*rn*ts**r.com [NC]
RewriteRule !^(robots\.txtĤforbidden\.html)$ - [F]

from access_log

66.***.40.70 - - [19/Nov/2003:00:53:17 -0800] "GET //robots.txt HTTP/1.1" 403 568 "-" "sit*ch*ck.int*rn*ts**r.com (For more info see: http://sit*ch*ck.int*rn*ts**r.com)"

Thanks

[edited by: jdMorgan at 10:18 pm (utc) on Nov. 19, 2003]
[edit reason] Obscured IP address & URL [/edit]

closed

2:19 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



Your pattern doesn't allow for slashes before the filename, so there wasn't a match.

keyplyr

9:53 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So this would work?

RewriteCond %{HTTP_USER_AGENT} ^(sit*ch*ck)?.?int*rn*ts**r.com [NC]
RewriteRule !^[b]/[/b](robots\.txtĤforbidden\.html)$ - [F]

Thanks

[edited by: jdMorgan at 10:19 pm (utc) on Nov. 19, 2003]
[edit reason] Obscured URL [/edit]

jdMorgan

10:15 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, because then, the slash will be required. You could follow the slash in the pattern with a '?', but I don't think it's worth the bother. This was an ill-formed request, and not likely to happen often. So I don't think it makes much difference whether you return a 200 vs. a 403 or a 404.

It's an interesting question at the margins of access control procedures, though -- It all depends on whether you want to consider a request for //robots.txt to be a request for /robots.txt.

I suppose you could also just 301 redirect //robots to /robots before your user-agent screening, and then let it get caught later. But as I said, it's a malformed request, and should be very rare.

Jim