If a link to an old thread has the form:
/modules.php?name=Forums&file=viewtopic&t=<number>
then a working new link can be constructed as:
/forum/viewtopic.php?t=<number>
(the new software automatically figures out the right forum number).
Similar a link to a certain post looks like:
/modules.php?name=Forums&file=viewtopic&p=<number>#<number>
To repair the anchor, one has to pass the "p" both as "p" and "e"; this looks like:
/forum/viewtopic.php?p=<number>&e=<number>
So to make all links working, one more or less needs to replace the /modules.php by /forum/viewtopic.php in the URL to keep things running.
This can be done at the server side via a small configuration change. Just do the following:
1. enable mod_rewrite if not already done so, e.g. by adding a line like
Code: Select all
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
(the path to the mod_rewrite.so might need to adapted to the actual directory layout on the server.)
2. Add the following lines to the config
Code: Select all
RewriteEngine On
RewriteLog /var/log/apache2/rewrite_dollform.log
# for debugging
#RewriteLogLevel 9
# for production
RewriteLogLevel 0
RewriteCond %{QUERY_STRING} ^(.*&)?p=([0-9]+)(.*)
RewriteRule ^/modules.php$ /forum/viewtopic.php?%1p=%2&e=%2%3 [R]
RewriteCond %{QUERY_STRING} ^(.*&)?t=([0-9]+)(.*)
RewriteRule ^/modules.php$ /forum/viewtopic.php?%1t=%2%3 [R]
3. reload the server config
Ready.
I have tested the performance impact on a local test server, and while my local server needs 0.4ms to send the 404-error page it needs quite the same time to send the redirect. Only if one sends very long malicious urls the server needs somewhat around 1.2ms to handle the request. I hope this performance increase is acceptable. (After all a normal page view needs around 500ms or so.)
If the server admins would consider this change, this would be highly appreciated, at least by me
Meanwhile all members who run into a 404 for an old link on the forum can just repair it by replacing "/modules.php" by "/forum/viewtopic.php" in the URL manually to see the post in the new forum.