• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 how to redirect from old forum to new xenforo

I'm trying to redirect the urls, as they were used by the old forum, to xenforo urls.

The old forum has urls like this for forums for example:


xenForo urls would look like this:


So, I thought I could just write some rewrite conditions and rules for mod_rewrite and it would work. But it doesn't and not really sure what I'm doing wrong.
I added these lines to the .htaccess in the xenforo directory:

RewriteCond %{QUERY_STRING} ^forum-showtopics-(.*)$ [NC]
RewriteRule index.php$ index.php?forums/%1/ [NC]

But if I enter an old url like:


I get this error: Route forum-showtopics-2/ could not be found.

What am I doing wrong here?
You should enter that redirect rules before the Xenforo provided rules in htaccess as once you are at index.php of Xenforo, it will not be redirected as the rule has L in it which means it is the last rule in the chain. Hope that helps.

Jake Bunce

XenForo moderator
Staff member
Try this:

RewriteCond %{QUERY_STRING} ^forum-showtopics-(.*)$ [NC]
RewriteRule index.php$ index.php?forums/%1/ [R=301,L]
If that doesn't work then try this:

RewriteCond %{QUERY_STRING} (^|\?)forum-showtopics-(.*)$ [NC]
RewriteRule index.php$ index.php?forums/%2/ [R=301,L]
I have learned to look for both ^ and ? as the beginning of a query string. This can depend on the web server.