Skip to content

Fix broken links

Most URLs to individual posts (e.g. if you open a particular category and try to navigate to a post) point to ../../../../../index.html?p=1234.html.

This is broken for two reasons. Most obviously, there is no server side code to interpret the request for ?p=12324.html and find the correct post to render. This has been fixed by adding a .htaccess file which finds query strings containing index.html?p=(\d+).html and redirecting to /forums/post/1234/index.html. To go along with this, I ran a script (available in the first commit) which:

  • greps each file for something which looks like a Wordpress post ID
  • each topic has several posts
  • Creates a symlink from topic/blah/index.html to post/POST_ID/index.html

The second problem is that ../../../../../ takes us all the way out of the /forums subdirectory for which this repository is responsible. That means we don't even have the ability to add custom .htaccess rules for such links, because they never hit our .htaccess file. To solve this, I hackily replaced each of the ../../../../../ with /forums/. It doesn't actually matter that it isn't pointing to a real file, because the mod_rewrite rules intercept it anyway (based on the index.html?p=1234.html).

Merge request reports