Configure .htaccess to allow awstats to work with clean URL's

Last modified: June 18, 2006 - 19:08

When I installed Drupal with clean url's it made my Awstats (within the cgi-bin) not work and just return a Drupal page not found error.

Drupal is installed in the root directory (public_html) of my web space so is the cgi-bin folder that Awstats is in.

I fixed the problem by changing the protect files and adding 1 rewriteCond line to the .htaccess file as follows:

In the FilesMatch section, find " |code-style\.pl " without the quotes and remove it from the following code:

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|Entries.*|Repository|Root)$">
  Order deny,allow
  Deny from all
</FilesMatch>

Now add this line (RewriteCond %{REQUEST_URI} "!cgi-bin/") to the following:

  # Rewrite current-style URLs of the form 'index.php?q=x'.
 
  RewriteCond %{REQUEST_URI} "!cgi-bin/"

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

This was all done on the default install of Drupal w/.htaccess.

 
 

Drupal is a registered trademark of Dries Buytaert.