I've changed the rewritten url's of the articles again. I noticed that some website (now unfindable of course) that had changed the urls for the articles to include the subject. I've done this also, for now just to see wether the search-engines like this. See links like this one. See the complete archive for a complete list of articles. See 'read more' for details.

I had thought of 3 ways of translating article-url's to longer url's:

  • 1) Add a static file, possibly generated
  • 2) Generate the list live and translate each url
  • 3) Change the News-module, creating different url's



Translation back would be possible in three ways:

  • 1) Still include the article-number, and then just ignore the text
  • 2) Have Apache call a external program from .htaccess, let that program do the translation live using database-query's
  • 3) Have Apache call a external program from .htaccess, let that program do the translation live using a pre-generated list



I've opted for both the first options. The static file used for translation of short url's to url's that include the subject, is generated by a php-script. Perhaps I'm able to execute the script when a new article is added, for now I'm just executing it by hand. Live generation of this list has one big advantage, it's always up-to-date. But I'm afraid that much database-access would be too much for my hardware.

The translation in .htaccess is simple:
RewriteRule ^article-([0-9]*)-([a-z]*)-([0-9]*)-([0-9]*)-([a-zA-Z0-9_-]*).html modules.php?name=News&file=article&sid=$1&mode=$2&order=$3&thold=$4 [L]
As you can see, the fifth parameter (the title) is simply ignored.

I've borrowed much of the ideas from someone else, parts are borrowed from Google Tap, Googlifier and GT-NextGen and a nice howto here (german).

So far I've changed or created:

  • a script that generates another php-script rewriting article-url's to include the subject, filtering out some characters
  • altered footer.php much like the howto, the way they handle the ampersands is great !
  • altered header.php to execute the generated script:
    //Check to see if file exists before continuing:
    if (file_exists("GT_translate.php")) {
       include("GT_translate.php");
       $s = replace_for_mod_rewrite_two($s);
    }
  • changed .htaccess to rewrite the longer url's correctly.
  • rewritten part of one block (old-articles) to show the new url's



For now I'll just wait and see what the search-engines do with this. I've seen some discussion wether this really helps, and it's for sure that only search-engines profit from this. Humans profit much from the shortest url's.

See the mod rewrite cheat sheet for some help !
Manual to be found here.