5 March 2005

Get Yer FQDN On

In a well-meaning effort to keep the IA home fires burning, I’ve taken another small-but-satisfying step in evolving this site’s URI design: Enforcing the use of Fully Qualified Domain Names for all HTTP requests at the Apt.

Here, try a sample link. Go on, try it, you’ll like it! (Maybe.)

Previous URI tweaks (or IRI tweaks, choose your poison) included the judicious suppression of file extensions, a.k.a. content negotiation, plus using the entry’s creation time instead of the title (or even the entry ID). Bottom line: I prefer to keep the entry URIs completely separate from the CMS and any server-side technologies. From what I can tell, I’m about as fussy as Drew McLellan when it comes to this stuff.

More adjustments are surely afoot. F’rinstance, I find the /controller/method/options URI model used by Rails rather appealing (echoes of Zope!). This model - not to mention Rails itself - may yet find a home here.

Right - meanwhile, back to the domain name thingy. “It ain’t done with smoke and mirrors.” Those with Apache and mod_rewrite can simply add the following to .htaccess in the document root.

Options +FollowSymlinks
rewriteEngine on
rewriteBase /
rewriteCond %{HTTP_HOST} !^www\.joesapt\.net$ [NC]
rewriteRule ^(.*) http://www.joesapt.net/$1 [L,R=301]

Replace joesapt.net with one of your own, natch. It goes without saying, please please please test on your end to verify it works as expected. If it doesn’t, and you’re not sure why, feel free to contact me and I’ll do my best to help out. There are plenty of subtleties with mod_rewrite and you may have rewrite rules or server settings in place that don’t play nice with the above. (They don’t call it the “Swiss Army Knife of URL Manipulation” for nothing.)

It’s nothing new, really it isn’t, yet a lot of sites do not employ this technique (including another one under my purview that shall go unnamed … but that’s another story, altogether*). You could likely argue that it’s all unnecessary, sure, but hey - that’s just me.

Who knows? You may be so inclined as to take the opposite tack, removing the www. It’s your call. Either way, you’ll wind up with more consistent linkage to and fro. Isn’t that swell?

Kreskin sez: If you paused to deadpan “but that’s another story” to yourself while reading that parenthetical remark, uhhhh, I bet you must be a Zucker/Abrahams/Zucker fan! Did I get it right? Huh? Did I? I guessed it, right? Amazing!

Posted by joe at 01:42 PM

Trackback Pings

TrackBack URL for this entry:
http://www.joesapt.net/mt/mt-tb.fcgi/11

Comments are closed for this entry.