Forum Moderators: phranque
I have used the following mod_rewrite directives in .htaccess:
RewriteCond %{HTTP_USER_AGENT} MS.*FrontPage [NC]
RewriteRule !^403.*\.html$ - [F]
RewriteRule .* - [F]
HTH,
Jim
I currently have custom error pages named:
ErrorDocument 400 /error.html
ErrorDocument 401 /authentication.html
ErrorDocument 403 /forbidden.html
Would your example still work?
Or should my custom error pages have a name that corresponds with the error number? Example:
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
<added>
I think I figured it out. To use my current file name, it should be:
RewriteCond %{HTTP_USER_AGENT} MS.*FrontPage [NC]
RewriteRule!^forbidden\.html$ - [F]
Thanks
</added>
I also get dozens of MSOffice errors. If I wish to deny also, would this work?
RewriteCond %{HTTP_USER_AGENT} MS.*FrontPage [OR]
RewriteCond %{HTTP_USER_AGENT} MS.*Office
RewriteRule!^forbidden\.html$ - [F]
Do users in the work place sometimes view sites with MSOffice? If so, maybe I should deny it? Thanks
[Mon May 19 13:20:00 2003] [error] [client 205.152.138.58] File does not exist:
/www/a/my_domain/htdocs/MSOffice/cltreq.asp
Hundreds of requests continue, despite using:
RewriteCond %{HTTP_USER_AGENT} MS.*Office
RewriteRule!^forbidden\.html$ - [F]
Is it possible that the UA should be written thusly?
RewriteCond %{HTTP_USER_AGENT} MSOffice
I've tried it for a couple hours. They have dropped down to just a few, but that could be chance. Has anyone else been successful blocking MSOffice?
"MS.*Office" will match "MSOffice" or "MS<anything>Office", so it should make no difference.
Microsoft's arrogance is what causes their products to continue requesting proprietary files despite being told they don't exist.
You could also try blocking by requested filename using %{REQUEST_URI} :
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} MS.*Office [NC,OR]
RewriteCond %{REQUEST_URI} MSOffice [NC]
RewriteRule !^forbidden\.html$ - [F]