Main Content

Every link has two ends - fixing 404s at the recipient

Archive - Originally posted on "The Horse's Mouth" - 2008-04-02 06:33:43 - Graham Ellis

"They have printed the wrong link." Thus starts a frustrated post on the Save the Train web site, worried that a link in the local newspaper to our support pledge page ends up at a "404". And, yes, they have dropped the newspaper a line too, hoping to catch them before the online edition goes "printed".

But every link has two ends ... and since the error in the URL still leaves the URL pointing to our server, and just the wrong place on it, a very short mod_rewrite request means that the paper's site is now pointing at the correct place - in addition to the URL that everyone else is using.

-bash-2.05b$ cat .htaccess
RewriteEngine On
RewriteRule pledge$ pledge.html
-bash-2.05b$


So that's /pledge linked to /pledge.html

It's not the first time I've done this "trick" and indeed, given a substantial number of erroneous follows, I can sometimes spot such things in our log analyses. In this case we caught it very early, though!