Monthly Archives: October 2007

.htaccess, WordPress and CustomError Pages Oh My!

This site runs WordPress, I also run WordPress on most of my money making niche VRE sites. WordPress does a great job and with plugins like wp-cache and All in One SEO Pack it makes getting a site up with search engine friendly URLS and meta content. It also makes it very easy to add content to your site so you stay indexed and relevant.

One of the big problems I was having recently was WordPress Permalinks we’re causing my awstats to not show up. It looked like mod_rewrite was doing something to the urls and they were being lost.

This didn’t really bother me much because I didn’t look at my stats all that often and when I wanted to take a peak I would disable the .htaccess, take a look then re-enable it.

Tonight this was starting to bother me because it becomes time consuming when you want to look at statistics for 12 sites. I decided to try and see if I could work out the root cause and fix it.

After about 30 minutes of reading and testing various settings I was confused so I decided
to enable mod_rewrite’s rewrite_log option with the RewriteLogLevel set to 9.

Looking at snip from the rewrite_log:

1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#87ff3c4/initial] (2) init rewrite engine with requested uri /awstats/
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#87ff3c4/initial] (1) pass through /awstats/
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (2) init rewrite engine with requested uri /401.shtml
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (1) pass through /401.shtml
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (3) [per-dir /home/myhostinguser/domains/stupidfoot.com/public_html/] strip per-d
ir prefix: /home/myhostinguser/domains/stupidfoot.com/public_html/401.shtml -> 401.shtml
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (3) [per-dir /home/myhostinguser/domains/stupidfoot.com/public_html/] applying pattern ‘.’ to uri ‘401.shtml’
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (4) RewriteCond: input=’/home/myhostinguser/domains/stupidfoot.com/public_html/401.shtml’ pattern=’!-f’ => matched
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (4) RewriteCond: input=’/home/myhostinguser/domains/stupidfoot.com/public_html/401.shtml’ pattern=’!-d’ => matched
1.2.3.4 – – [30/Oct/2007:21:21:24 -0400] [www.stupidfoot.com/sid#87f0494][rid#8956514/initial/redir#1] (2) [per-dir /home/myhostinguser/domains/stupidfoot.com/public_html/] rewrite 401.shtml -> /index.php

From that we learn that I have ErrorDocument 401 /401.shtml which means all requests for authenticaton are being sent to /401.shtml and because I don’t have a 401.html we get redirected back to /index.php and index.php thinks we have a story called awstats which we don’t.

There are a few ways you can solve this.

  1. Disable the ErrorDocument by adding ‘ErrorDocument 404 default’ to your .htaccess file
  2. Remove or set ‘ErrorDocument 404 default’ in httpd.conf or your vhost.

I chose method 2 because it was less work for the 12 sites I have running. This setup of custom ErrorDocument(s) is done by some hosting packages, Cpanel and DirectAdmin just to name two.

This should help all of the people who have been having similiar problems who I’ve seen posting on the WordPress forums.

Mac OS 10.5 Leopard – so far so good

mac os box logo I picked up a 13″ black MacBook in June of this year to replace my compaq. I’ve had a 450Mhz G4 Cube running 10.4 Tiger mainly for Safari to test out some web development and it wasn’t that bad to use for email and browsing.

I had a good idea what to expect from a MacBook and it was everything I had expected and wanted from a computer. By day I work as a Systems Administrator for a cellular company and am waist deep in Linux, OpenBSD and FreeBSD. I’m very conferable on the command line and monkeying around with things to get them to work just the way I want. When I first started using my MacBook daily I noticed that I didn’t have to do much to get things to work. It went like this.

“Hey I want to join the WPA network at work how would I do that, maybe I need to edit something or compile something. Hey let me click the little airport thing in the top bar. Oh hey theres the work network *click* Oh nifty its prompting me for the password *types password*. Hello Internet”

I know its been said before and will be said again but you really do Think Different. Its that things really do Just Work. I’ve never seen anything like this with a computer. There is no monkeying around at all. Most things work just how you would expect them to.

I was a little worried about upgrading to Leopard because I’ve never done an upgrade on a mac before. My G4 came with Tiger setup and the install DVD so I didn’t have to worry about settings or anything when I reinstalled that. I was worried I would lose my settings and pictures and music and everything. I posted on some forums and was assured that it wouldn’t be a problem and would just work.

I got home from work to find the FedEx package waiting, I opened it up and was again impressed with apple and their level of detail and overall product packaging. I wanted to test first on my G4 Cube but quickly found out that it will not install on a 450Mhz processor. With that I slid the disk into my MacBook and clicked the Upgrade button and the MacBook rebooted.leopard_box_125.jpg

I walked through the installation which was only
answering a few questions

  • Chose an language
  • Confirm you install disk
  • Affirm to a license agreement.

The installation scared me when it said it would take 5 hours and 31 minutes to complete. I didn’t know what to do so I just let it do it’s thing. It really only took about an hour or so to run, I’m not exactly sure because my wife and I were watching a movie.

All is said and done and it wants me to reboot. I’m scared when I see a familiar blue screen and not my desktop but I sat there just waiting and hoping it worked and I just hadn’t lost everything. As if by magic there was my wallpaper and desktop. It had kept all of my user settings and programs I had installed.

It could be in my mind but it seems snappier and more responsive. There doesn’t seem to be any lag when opening windows or changing spaces. There was some very sluggish performance when I first upgraded but that was to Spotlight rebuild its index and TimeMachine doing its thing on my external 320Gb FireWire drive.

 

promo_leopard_utd.jpg I stopped TimeMachine and let Spotlight finish its index and just before I started this TimeMachine started and is now doing a full back up of about 111GB. There doesn’t seem to be any performance penalty or anything while it runs. The MacBook is just as fast if not faster than before with Tiger.

All in all I’m happy with the upgrade. The two features I think I like the most so far are Spaces and a tabbed Terminal.app. I’m sure I’ll find more things I like in the coming days when I have time to explore.

A brief intro about this blog

Some of you may know me from my other blogs and sites. To those of you who do know me stay tuned this is going to get interesting. To those of you who are new or have no clue what I’m talking about stick around.

I’ll be going over some of what I’m working on to try to make a living on this wild west that is the Internet.¬†I’ll be going over what I do on my blogs, sites and side projects, things like search engine¬†optimization, database back end stuff and some of the python and perl code that glues everything together.

Some of you may know some of my other sites but I doubt anyone knows them all as a few of them are covert things with a small private community. I will not be talking much about the details of those but will be going over some of the ideas that I’ve used to make them successful and earn money.