Beware the power of .htaccess

Ok, this is an egg on my face story:

On Janaury 9th, I wrote about adding Jeremy’s comment spam prevention code to my site. I also added the code to my .htaccess file. All has been well. I’ve gotten dramatically less spam since then… however…

I logged into my Google Adsense account the other day, and noticed that my earnings were way down… waaaay down. And that got me concerned. At first I suspected Google did a Google Dance on their servers, and that was sending a lot less traffic to me… but I figured if that had happened, a lot of other people would be complaining too, and I hadn’t noticed that… so…

I started looking at when the traffic dropped off, and I realized it apparently happened on January 10th. So, I read what I wrote on the 9th and/or 10th, and realized that I probably broke my site when I played with my .htaccess file, as it was all working fine before I played with that file.

Sure enough, none of the links on my site were working. See, I’ve got “extension free urls” which is a trick I pulled off, so that you can look at this url:

http://www.inluminent.com/weblog/archives/2005/01/09/comment_spam_prevention/
instead of this url:
http://www.inluminent.com/weblog/archives/2005/01/09/comment_spam_prevention.php

Not a huge deal, but enough that I like having “extension free urls”. Well, none of those links were working… but the real url (with the .php) was working fine, so I knew it wasn’t my entire site that was broken…

Anyways, I started investigating the .htaccess files for this site, and I had like 4 or 5 saved versions (I always save a copy, just in case I break something)… but none of them were from Janaury 9th. (I save files with this filename format filename.save.20050109 so that I know when they were saved from.)

I figured that maybe I didn’t save a copy, so I started playing with the .htaccess file powering the site, deleting stuff, and moving stuff around, and nothing was working. So I changed the owner to my useraccount and to root, and chmod’d it to 777, 755, 555, 677, 766, all manner of different combinations…

All to no avail.

Then I thought maybe I created a new .htaccess file in the /weblog directory for some reason, in addition to the one that sits at the root directory for this site.

Sure enough, that’s what I did. And the two files weren’t playing nice to each other, for whatver reason.

I deleted the extra file, and viola, all is well again.

Like I said, beware the power of .htaccess when you don’t really understand how mod_rewrite works, or rather, beware my own idiocy.

So, here’s to getting the Google traffic back to my archive pages, which is obviously where 90% of my Google revenues come from.


2 Responses to “Beware the power of .htaccess”  

  1. Gravatar Icon 1 john

    testing the comment system… please ignore

  2. Gravatar Icon 2 John

    and here’s another test… this one in WP.

Leave a Reply





Bad Behavior has blocked 3783 access attempts in the last 7 days.