Resource icon

xF2 Redirection scripts Redirection Script for phpBB 3.2/3.3+ (without SEO URLs) htaccess 1.0

No permission to download
Compatible XF Versions
  1. 2.0
  2. 2.1
Additional Requirements
Apache htaccess
This script is based on different htaccess rules posted on xenforo forums and my own editing.

Requirements:

This script assumes you have friendly urls enabled for Xenforo.

What it will do

"/viewforum.php?f=X" will redirect to "/forums/X/" and
"/viewtopic.php?t=X" will redirect to "/threads/X/" and
"/viewtopic.php?p=X" will redirect to "/posts/X/".
"/memberlist.php?mode=viewprofile&u=X" will redirect to "/members/X/".

If you have /threads/title.x/ type of urls for xenforo, there might a second redirect by xenforo itself where it would redirect from threads/x/ to threads/title.x/

Installation
Insert this in your .htaccess file preferably BEFORE or ABOVE Xenforo friendly url redirect ( RewriteRule ^.*$ index.php [NC,L])



Code:
   RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /threads/%2/? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
        RewriteRule ^(viewforum\.php|viewtopic\.php)$ /forums/%1/? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /posts/%2/? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} u=(\d+)$ [NC]
        RewriteRule ^memberlist\.php$ /members/%1/? [L,R=301,NC]

Done. That's all there is to it

If your forum is installed at say /forums/ then add /forums/ before the redirect in above script for example /threads/%2/? will be /forums/threads/%2/?
Author
Admin
Size
1,023 bytes
Extension
txt
Downloads
3
Views
2,642
First release
Last update

More resources from Admin

731Threads
2,287Messages
63,850Members
udncgLatest member
Back