December 30, 2004

Smart URLs

Anne van Kesteren writes about creating smarter URLs by dropping the suffix and/or using redirects. I'm all in favor of sane URLs (especially since I've created a few insane--or at least mildly unhealthy--ones in the past).

We've been moving a few files and directories around lately at work. We're doing this mostly to either correct mistakes (misspellings) or create a bit nicer hierarchy (like actually putting pages in the "About" section in the /about/ directory). As good little web developers, we're redirecting users to the current page. The technology of choice is mod_rewrite. But, one of our server guys recently recommended we use symlinks ("ln -s [to] [from]" in the shell). I'm not entirely which way would be best. I like the organization of having everything in one file (.htaccess) rather than spreading symlinks around the file structure. But, there might be a slight performance gain by not having Apache check every request against the mod_rewrite rules (although I suspect the gain would be fairly minor). Any opinions on this out there? Email me.

(via Nick Finck)

Update: Anne wrote in and came down in favor of mod_rewrite:

If you can, put the redirects in the httpd.conf file from Apache. That file is cached. mod_rewrite is only a little bit of overhead. On a low traffic site you do not need to worry about it.

I'm running what I'd call a moderate traffic site...or at least we've had periods of fairly high traffic (took down an oddly configured server cluster at one point w/ too much traffic). I'm not super concerned about the mod_rewrite overhead, but I am reasonably aware of anything that could slow down the site.

Anyway, for most things, I think I'm still in favor of mod_rewrite. Anyone have a compelling argument for symlinks?