My .htaccess File is Messing Up awstats on Wordpress Blogs

I use DirectAdmin for my hosting control panel. There is a nice plugin to add awstats, but I’ve found they don’t work on sites where I have WordPress set up (such as this site) because I’m using permalinks. No worries though. I found a way to fix it. Just put the bolded line below in your .htaccess:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/awstats.*$ [NC] [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

*Note: Replace “awstats” with the name of your stats location

Related posts:

  1. Windows Live Writer Wordpress Fix So when I first tried Windows Live Writer, it seemed...
  2. Webfaction Review I was looking at my web stats and noticed I...

Related posts brought to you by Yet Another Related Posts Plugin.

November 5, 2007   Posted in: Programming & Internet

12 Responses

  1. jessie - December 20, 2007

    xhenxhe, i came across your community post at bumpzee… well, as to this post, why not use an online .htaccess generator or try deleting the .htaccess file… i don’t have a .htaccess file and still everything works… ur right about saying the .htaccess file messes up with some domain-related issues. other experts even recommend that it be deleted so i did for my site

  2. Dustin - December 20, 2007

    Well, I prefer to have it in order to get SEO friendly URLs. This is more important that seeing my site stats.

  3. Mats - March 17, 2008

    I tried to do this but I still get a 404-message. Should I just write /awstats/ or /domains/topsecret.com/public_html

  4. Mats - March 17, 2008

    Well, it worked when I wrote it under;

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    That’s a bit weird. But I’m happy as long as it doesn’t hurt me in the long run. :)

    Thank a lot!

  5. Mats - March 18, 2008

    Well, now it stopped working again. Huh? This is beyond weird.

  6. Jimmy Hennessey - May 3, 2008

    I had no choice. I had to give up on wordpress. I use Godaddy for my hosting. If you don’t run Linux, the hosting is not at all script friendly. I know I should change the hosting or the OS but I’m like an stubborn old man, change is scary! Actually, I’m almost 38, the word “like” doesn’t apply anymore…..:-o

  7. Kryptik from Top Rap Videos - January 28, 2009

    Well I don’t know if you’ve done much changing in the last year, but I have to agree with the having to change hosts. I changed from them because they simply couldn’t support what I wanted to do. Plus, things not working, only adds to you being scared of change. I just got my first wordpress blog up a few days ago, but it installed without issue, even on a free host. GoDaddy just ain’t no good.

  8. anne from My Love - April 15, 2009

    Plus there are really good plugins nowadays that are free. I haven’t got any issues with GoDaddy as far as webhosting though, and its also quite cheap.

  9. my_world » .htaccess konflikt mellan Wordpress och AWStats - June 21, 2009

    [...] bloggen Nerdy Dork erbjuder Dustin Davis en lösning på denna problem. Man lägger till följande kod i .htaccess [...]

  10. Albatol Network - July 27, 2009

    Thanks Dustin,
    that small change made my url’s seo friendly even though wp #1 seo script but this small touches/changes made it more great..
    thanks again m8

  11. James from 32 LED TV - August 18, 2009

    @Jimmy – I can highly recommend Hostgator. I have a couple of Wordpress blogs hosted with them and I’ve never had a problem.

    @Dustin, sorry to hijack your post to give Jimmy some help :) . Thanks for the awstats fix – I’ve tried a number of other ideas that were recommended on the forums but this is the only one that works – top man.

  12. Dave from making money on the internet - October 5, 2009

    Just a heads up I have found that AwStats is really inaccurate for tracking website visits, as it will log many bots as unique visitors. Some better and easier alternatives are statcounter and google analytics…

    Dave

Comments are closed for this entry.