Blogging since 2008 until 2010

Hard links and Apache mod_rewrite

I've been as busy as a bumble bee. I've sorted out the hard links for the RSS feed. You now get a link to a page displaying just the post you want to read. And the URL is something like instead of Google seems to like URLs that mean something :-D

The hard links are just the title of the page with all non-alphanumeric characters removed, made to be lower case and spaces replaced by underscores. Oh, and they're prefixed with 'p' to make them easy for Apache modrewrite to spot :-)

For anyone interested, the RewriteRule is in the .htaccess file and is mad simple...

RewriteEngine on
RewriteRule     ^p_([a-z_0-9]*)     ./page.php?page_hardlink=$1

It matches anything starting with 'p' followed by lower case letters, numbers and underscores. Everything after 'p' (the bit in brackets) is referenced by $1 in the re-direct URL.

The result is that a request to /p_rss_ftw would be redirected to ./page.php?page_hardlink=rss_ftw

Right, what's next? Comments I think. Maybe a general contact form too. Or pagination.

In the slightly longer term: I'm going to be posting a few tutorials I wrote for an old and failing site of mine. I'd like to put links to them somewhere on the page; but where? The top bar was only originally intended for links to the RSS feed etc. Any suggestions would be most appreciated. Send them to mail at this domain dot com

First posted: Sun, 04 Jan 2009 15:47:12 +0000