Dreamhost stats not working after installing WordPress

After installing WordPress via Dreamhost’s handy one-click installer, I was unable to view the nightly web statistics generated for the site in the /stats directory.

After a small amount of poking around, I found that this was due to WordPress writing a local .htaccess file in the domain’s root directory which takes precedence over the global server setting.

In order to correct the problem, you must enter the following code in the local .htaccess file, before the section containing the WordPress settings:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
RewriteRule . - [L]
</IfModule>

So your final .htaccess file should look something like:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Be the first to comment

Leave a Reply

Your email address will not be published.


*