Gun Show Listings

Now that I’m getting the hang of Expression Engine, it didn’t take me very long to convert my gun show listings to an EE weblog. It took a little hacking of the EE code itself, because it doesn’t display future entries by default. However, the support forums and knowledge weblog explained what to do.

Now, each show is a weblog entry whose entry date is the date of the show. The table of shows on the main page is generated from the weblog entries, displayed in ascending order. In addition to being automatically generated (in the past I had to hand edit the HTML every time the page changed), I now allow comments on each show (although they’re moderated to prevent any spam nonsense).

To prevent anyone who linked to my old page from being broken, I installed a custom 404 handler that uses PHP to look at the requested URL and determines where to send the user. Here’s what that code looks like, in case anyone is interested in doing something similar.

<?php

$redirects = array( "/index.html" => "http://www.aubreyturner.org/",
   "/gunshow2003.html" => "http://www.aubreyturner.org/gunshows/",
   "/gunshow2004.html" => "http://www.aubreyturner.org/gunshows/" );

$loc = $redirects[$REDIRECT_URL];
if( $loc != "")
{
   header("HTTP/1.1 301 Moved Permanently");
   header("Location:".$loc);
}

?>

Comments are closed.