Forum Moderators: DixonJones
I personally hate typing passwords, so when F-fox was nice enough to allow me to set the user agent to anything I wanted, I just added this to my .htaccess file in my publicly available logs:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^me$ [NC]
RewriteRule . - [F]
Then I added the useragent 'me' to F-fox.
Now all access is denied unless someone happens to set their user agent to 'me' and I simply switch my useragent while I want to look at my logs.
Justin
Obviously 'me' can be easily changed to you.
I just don't like to type user names and passwords, and thought there might be some other people in the same situation, so now I just add a charatcer or string to my browsers useragent, and I can actually not even change that for other sites, but I am the only one with access to my logs.
EG if my actual .htaccess was:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT}!^Mozilla/5\.0-J$ [NC]
RewriteRule . - [F]
And I add -J to my browser useragent I can browse all day long, check my logs, never change anything, and I am the only one who has access to my log files, because if you do not have your useragent set to the exact string I have in my file, you get a 403.
Just thought some people might find it useful...
Justin
Added: It's also helpful for multiple sites, because rather than having to login in to all of the individual 'stats' I can use the same .htaccess file, and effectively have password protection by useragent rather than formal 'password' files for each one.
<Location /stats>
Order Deny,Allow
Deny from all
Allow from 123.456.789.NN
</Location>
Where NN could be left blank to allow access from the whole range, or you can set it to specific IP address.
Note: I didn't test this, but I am pretty sure it should work.
Check out Apache docs [httpd.apache.org] for more info.