Here's a recipe for awstats using mod_rewrite. The page is protected by an access control list allowing access from a specific network, as well as asking for a username and password if you try to access from elsewhere.

Place this within your virtualhost(s), and go to

  ## Enable rewriting
  RewriteEngine On

  ## Rewrite matching URLs
  RewriteRule /awstats-icon(.*) /usr/share/awstats/icon/$1 [last]
  RewriteRule /stats(.*) /usr/lib/cgi-bin/$1 [last]

  ## Restrict access to awstats
  <Location /stats>
    SetHandler cgi-script
    Order deny,allow
    Deny from all
    Allow from
    AuthName "Lies, damn lies and statistics"
    AuthType basic
    AuthUserFile /etc/apache2/passwd
    Require valid-user
    Satisfy any

(Note: The paths used here are from the Debian/Ubuntu package)

  • No labels