XF 2.2 Link structure / Routes

szymme

Member
Dear Xenforo Community,


I installed wordpress and moved my forum to new folder xxxxxx.de/forums

Now some old links are not working.
Is it possible to change /community/forums link structure to /forums ?
 
you can add something like this rewrite-rule to your .htaccess file in your root folder.

Code:
RewriteRule ^community/forums/(.*) https://%{HTTP_HOST}/forums/$1 [R=301,L]

If you don't have a .htaccess file with rewrite rules, full code:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^community/forums/(.*) https://%{HTTP_HOST}/forums/$1 [R=301,L]
</IfModule>
 
Oh, so you had XF in the root directory and now it's in the subfolder forum?

And I assume you mixed "forums" and "forum" in your post - or did you use route filters for your routes?

At the moment your site shows a 500 server error.

Maybe try this first in your root folder:

Code:
RewriteRule ^forums/(.*) https://%{HTTP_HOST}/forum/forums/$1 [R=301,L]
 
RewriteRule ^forum/(.*) https://%{HTTP_HOST}/forum/forum/$1 [R=301,L]
yeah, that produces an endless loop. :D

try:
Code:
RewriteCond %{REQUEST_URI} !^/forum/forum/
RewriteRule ^forum/(.+) https://%{HTTP_HOST}/forum/forum/$1 [R=301,L]

You have to add rewrite-rules for each route you use, e.g.

thema/ -> forum/thema/
register/ -> forum/register/
login/ -> forum/login/
mitglieder/ -> forum/mitglieder/
...
 
I tried but it is still not working.
I dont know why, but

thema/ -> forum/thema/
register/ -> forum/register/
login/ -> forum/login/
mitglieder/ -> forum/mitglieder

is working with the right links with a single "forum/" without routes/httacess changes.
Maybe because of my root setting in xenforo?

Before moving the forum into folder ("/forum") the structure was https://traden.de/forum/ and now the category links are https://traden.de/forum/forum but the forum overview is https://www.traden.de/forum/

i dont get it.
 
I tried but it is still not working.
I see you are experimenting with routes inside XF.. now you have a route filter trading for forums (instead of forum).

It would eliminate a lot of problems, if you would chose a different folder name for your XF installation, e.g. trading-forum; some route you never uses before in your root folder.

Then you could do something like this for each of your routes (replace folder):
Code:
RewriteRule ^folder/(.+) https://%{HTTP_HOST}/trading-forum/folder/$1 [R=301,L]

or even better:

Code:
RewriteCond %{REQUEST_URI} ^thema/ [OR]
RewriteCond %{REQUEST_URI} ^register/ [OR]
RewriteCond %{REQUEST_URI} ^login/ [OR]
RewriteCond %{REQUEST_URI} ^mitglieder/
RewriteRule ^(.*) https://%{HTTP_HOST}/trading-forum/$1 [R=301,L]

or in 1 line:

Code:
RewriteRule ^(thema|register|login|mitglieder)/(.*) https://%{HTTP_HOST}/trading-forum/$1/$2 [R=301,L]

(all untested!)
 
Last edited:
I see you are experimenting with routes inside XF.. now you have a route filter trading for forums (instead of forum).

It would eliminate a lot of problems, if you would chose a different folder name for your XF installation, e.g. trading-forum; some route you never uses before in your root folder.

Then you could do something like this for each of your routes (replace folder):
Code:
RewriteRule ^folder/(.+) https://%{HTTP_HOST}/trading-forum/folder/$1 [R=301,L]

or even better:

Code:
RewriteCond %{REQUEST_URI} ^thema/ [OR]
RewriteCond %{REQUEST_URI} ^register/ [OR]
RewriteCond %{REQUEST_URI} ^login/ [OR]
RewriteCond %{REQUEST_URI} ^mitglieder/
RewriteRule ^(.*) https://%{HTTP_HOST}/trading-forum/$1 [R=301,L]

or in 1 line:

Code:
RewriteRule ^(thema|register|login|mitglieder)/(.*) https://%{HTTP_HOST}/trading-forum/$1/$2 [R=301,L]

(all untested!)
god bless you :) Your solution works for me now, after I changed main board url to traden.de from traden.de/forum (...dont understand what it change)
 
Back
Top Bottom