Topic: SEF making punbb 1.2x compatible

I used an mod for SEF URLs in PunBB 1.2.x. The URLs looked like:

for post: pxxx.html (p1938.html)
for topic: txxx.html (t282.html)
for forum: fxxx.html (f2.html).


However, the SEF URL scheme is different in 1.3.x. As a result, when I enable SEF URL in new punbb old SEF URLs don't work anymore. That's why I could not use new SEF scheme in PunBB 1.3.x. However, today I planned to make a solution.

I have enabled File based URL Scheme. then I have appended the following lines in include/url/File_based/rewrite_rules.php

'/^t[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                    =>    'viewtopic.php?id=$1',
    '/^p[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                    =>    'viewtopic.php?pid=$1',
    '/^f[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                    =>    'viewforum.php?id=$1',

i can't explain these as I am poor at Regex. However, it apparently worked for me. I will test it for a few days though smile.

Re: SEF making punbb 1.2x compatible

Here the version of optimized rewrite rules for you:

$forum_rewrite_rules['/t([0-9]+)(\.html?|\/)?/i'] = 'viewtopic.php?id=$1';
$forum_rewrite_rules['/f([0-9]+)(\.html?|\/)?/i'] = 'viewforum.php?id=$1';
$forum_rewrite_rules['/p([0-9]+)(\.html?|\/)?/i'] = 'viewtopic.php?pid=$1';

Re: SEF making punbb 1.2x compatible

wow,
thanks a lot. i will update my rules.

thanks again for your help.

Re: SEF making punbb 1.2x compatible

I like this's, cool!