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

XF 1.2 Redirect question (phpbb w/phpbbSEO)

#1
Hi there,

First of all, congratulations on a great forum product! I have been a phpbb user for the last 10 years, but have lately have had a lot of problems upgrading and keeping it up to date, so recently bought a licence for Xenforo. Did a test import (25.000 users, 145.000 posts) and it worked like a dream. :)

My last hurdle before moving the live forum is the question of redirects. I will install the new Xenforo in a new folder. I will keep the IDs the same.

Old forum: root/board
New forum: root/community

I have seen a post here about redirecting the standard phpbb urls, my problem is that I have phpbbSEO mod installed, so my phpbb urls are not standard and google have indexed these customs urls.

Most of my urls have this format:
root/board/el-camino-del-norte/
..and it needs to be redirected to:
root/community/forums/el-camino-del-norte.21/

Example posts:
root/board/el-camino-del-norte/topic19085.html
needs to be redirected to:
root/community/threads/hello-from-the-norte.19085/

One forum (with the most posts, about 50.000 posts) have this format:
root/board/el-camino-frances/
needs to be redirected to:
root/community/forums/camino-frances.12/
(This is not the same as above since the old forum has "el-" in the forum name, and the new forum does not.)

Then I have 5 forum with this url format:
Old forum: root/board/gear-for-sale-gear-needed-f106/
New forum: root/community/forums/gear-for-sale-gear-needed.106/

Old forum: root/board/camino-del-mar-f112/
New forum: root/community/forums/camino-del-mar.112/

Old forum: root/board/camino-castellano-aragones-f110/
New forum: root/community/forums/camino-aragon%C3%A9s.33/

Old forum: root/board/camino-del-sureste-f108/
New forum: root/community/forums/camino-del-sureste.108/

Old forum: root/board/ruta-del-ebro-f107/
New forum: root/community/forums/ruta-del-ebro.107/

My question is: Is it possible to write redirects in the htaccess file with one general redirect rule, then have 6 exceptions and hard code those exceptions in? (my 6 exceptions would be the 5+1 forum above).

I hope my question makes sense... and thank you in advance for any help.

Best regards,
Ivar
 

Jake Bunce

XenForo moderator
Staff member
#2
Put this in a .htaccess file (or at the top of an existing .htaccess file) in the /board directory:

Code:
RewriteEngine On

RewriteRule ^[^/]+/topic([0-9]+)\.html$ /community/threads/$1/ [R=301,L]
RewriteRule ^.+-f([0-9]+)/$ /community/forums/$1/ [R=301,L]
For those forum URLs without ids you need to do it manually. Example:

Code:
RewriteRule ^el-camino-del-norte/$ /community/forums/el-camino-del-norte.21/ [R=301,L]
 
#4
Hi again,

I have now done the move and we are live on Xenforo. I just realized that the htaccess works fine for the posts-rewrites, but not for the individual forums... my htaccess file is as follows:

Code:
# Lines That should already be in your .htacess
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>

# You may need to un-comment the following line
# Options +FollowSymlinks
# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On

RewriteRule ^[^/]+/topic([0-9]+)\.html$ /community/threads/$1/ [R=301,L]
RewriteRule ^.+-f([0-9]+)/$ /community/forums/$1/ [R=301,L]

RewriteRule ^(.*) /community/ [R=301,L]

RewriteRule ^announcements-your-feedback/$ /community/forums/announcements-your-feedback.9/ [R=301,L]
RewriteRule ^frequently-asked-questions/$ /community/forums/frequently-asked-questions.16/ [R=301,L]
RewriteRule ^pilgrim-introductions/$ /community/forums/pilgrim-introductions.14/ [R=301,L]
RewriteRule ^moderator-conversations/$ /community/forums/moderator-conversations.36/ [R=301,L]
RewriteRule ^el-camino-frances/$ /community/forums/camino-frances.12/ [R=301,L]
RewriteRule ^camino-frances-blogs-photo-albums/$ /community/forums/camino-frances-blogs-photo-albums.59/ [R=301,L]
RewriteRule ^camino-frances-albergues-pensions-and-hostals/$ /community/forums/camino-frances-albergues-pensions-and-hostals.80/ [R=301,L]
RewriteRule ^el-camino-portugues/$ /community/forums/camino-portugues.13/ [R=301,L]
....and then it continues with a total of 94 forum rewrites.

Example urls:
http://www.caminodesantiago.me/board/el-camino-frances/‎
should re-direct to...
http://www.caminodesantiago.me/community/forums/camino-frances.12/

..but instead it redirects to the new forum home.

htaccess file is located in www.caminodesantiago.me/board/

Ideas?

Thanks!
Ivar