WordPress mod_rewrite hiding stats



I’m running a site on WordPress and can’t access my stats because mod_rewrite is sending me back to the index and WordPress can’t find what it wants so I just get a 404. I’ve been playing with .htaccess and got it to work… but the next day it stopped working. Here’s what I’ve got now.

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

This has been really frustrating and doesn’t make sense to me – especially the fact that it worked when I first tried, and then just didn’t anymore the next day. Any tips? If I could just make a php file and include() the stats page that would be good enough for me.


  • jared


Well, you have the correct idea, but you have not really implemented it completely. By not using a separate " “section” for you WordPress stuff, WordPress will overwrite your .htaccess entries with it’s own in certain circumstances (which could account for why it “worked” at one point, and then broke).

I suggest you try the method described in this DreamHost wiki article on making stats available via .htaccess, which uses WordPress as an example, and see if you have better results.



That’s exactly what I needed, just couldnt find a link. Thanks!

  • jared


You’re welcome, and I hope that you can get it working properly with that information! :slight_smile: