Archives » July 2nd, 2005

July 2, 2005

June Ormsby House Update

The year is halfway over, and the Ormsby House is halfway done! What a coincidence! What a perfect time for another update!

The June Gallery is now live. And this month brings a new virtual home for the Orsmby House. I’ve moved the gallery from the Computer Vet over to my new website, Around Carson. This new site is meant to provide coverage of all things Carson City and Carson Valley, and the Ormsby House fits in with that perfectly. So the gallery has a new URL,

Of course, things never go smoothly. I figured out how to set up an Apache redirect so that all requests for the gallery at the Computer Vet would be forwarded automatically to Around Carson. And it was working fine. But then something happened; maybe I accidentally overwrote the .htaccess file or something, but the redirect went dead. And I had already removed the gallery from Computer Vet, so people who were following Computer Vet links were getting nowhere. 404. And, since Google had indexed the Computer Vet URL, I was dropped from Google. After untold days I discovered the snafu and fixed the redirect, and everything’s back to the way it was. But I’m sure there’s going to be some fallout from all of this, especially trying to get back to the top of Google.

Anyway, you can poke around the rest of Around Carson if you want, but there’s not a lot to see. The only part that’s really ready is the Around Carson Forums, where I just happen to have made a special forum for the Ormsby House. If you want to talk about your Orsmby House memories, that’s the place you should go.

Or, just enjoy the update.

URL Rewriting and mod_rewrite Not Working? Read On!

Okay, so I was trying to use mod_rewrite on Apache. That’s the program you use to take a URL like this: /photos/viewphoto?photoid=5 and turn it into something pretty like: /photos/viewphoto/5. It makes your URLs look better on the surface, but underneath the server still gets to play with all the messy query strings that keep your database-backed site humming.

So anyway, I was trying to do the example shown above, and every online tutorial showed me that I should put these lines in my .htaccess file:

RewriteEngine on
RewriteRule viewphoto/([0-9]+) viewphoto.html?id=$1 [NC]

But it was not working. Just was not. I would go to /photos/viewphoto/5, and get the viewphoto.html page with no query string attached to it. What could be wrong?

On a whim once, I changed the URL requested to /photos/viewPhoto/5. Notice the capital P? That made it work. But why? Why would it work with a capital letter, but not all in lower case?

After much walking around and banging my head, I finally figured out the reason. mod_rewrite only works if you’re getting a 404 error from your URL. When I requested /photos/viewphoto/5, the server could see that there was already a file named viewphoto.html. So it just served up that file, and didn’t get mod_rewrite involved at all. What I had to do was change the URL so that I’d get a 404 Page Not Found error if my rewrite rules weren’t there. So I did this:

RewriteEngine on
RewriteRule view/([0-9]+) viewphoto.html?id=$1 [NC]

And requested the page like so: /photos/view/5. Now, because there was no view.html, the server sent the request to mod_rewrite, and my rewrites happened like I wanted them to.

So be careful about this if you’re using mod_rewrite. Don’t give your “pretty” URLs a filename that actually exists on the system, or your rewrites will never work.

To see this at work, check out a sneak preview of my new Around Carson website. I’m using it in the photo section.