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

XF 1.1 Can't get the redirect from phpBB to work

Hilmer

Active member
#1
I can't get the redirect to work. Nothing happens when I enter the old forum
:(

I would like to redirect users that enter our old phpBB forum direct at www.hilmer-koch.dk/foto-forum
to the new Xenforo one at www.hilmer-koch.dk/forum
It would be perfect not to loose the page ranking in the search engines but I don't know how a redirect will affect this?
I have tried this code:

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

So not this is how my htaccess file looks:
# # Uncomment the statement below if you want to make use of # HTTP authentication and it does not already work. # This could be required if you are for example using PHP via Apache CGI. #
#<IfModule mod_rewrite.c>
#RewriteEngine on
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#</IfModule>

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

MattW

Well-known member
#2
Based on this

Code:
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC] 
RewriteRule ^viewtopic\.php$ /foto-forum/threads/%2? [L,R=301,NC] 
RewriteCond %{QUERY_STRING} f=(\d+)$ [NC] 
RewriteRule ^viewforum\.php$ /foto-forum/forums/%1 [L,R=301,NC]
You are telling the .htaccess file to re-direct them back into the old forum directory

You will need to add a .htaccess file into the OLD forum directory, foto-forum and use that to re-direct them back to the new forum directory.

 

Jake Bunce

XenForo moderator
Staff member
#3
Did you select the option during the import to preserve the source ids?

Try removing the red parts:

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

Hilmer

Active member
#4
Okay guys - thank for the replies.

As you can see from my .htaccess file I have already tried to add the code and I have also tried with forum instead og foto-forum
The .htaccess file is in the /foto-forum root dir.

The old one was /foto-forum and the new one is forum.

Nothing happens, when I enter the old forum.

Jake - I cant remember, how can I find out?

All the best
Morten
 

Jake Bunce

XenForo moderator
Staff member
#5
The .htaccess file needs to be in the foto-forum/ directory.

I can take a look if you are comfortable giving me FTP access to your server.
 

Jake Bunce

XenForo moderator
Staff member
#9
Try removing the carrots like I posted before:

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

Hilmer

Active member
#10
Strange - nothing works :(

Now my file is named .htaccess placed in the main forum folder, and it looks like this:



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

(n)
 
#11

Hilmer

Active member
#12
This is really driving me crazy!

The old PHPbb3 forum and the new Xenforo is on the same server, and on the same homepage - www.hilmer-koch.dk.

the old is /foto-forum
the new /forum

When a user enter the old forum (/foto-forum) I would like the adress to change to the new one (/forum) without delay.

I have tried to make a .htaccess file that contains this code and placed it in the /foto-forum root. (old forums root)

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

Hilmer

Active member
#15
Hi Jake that is so kind of you. I ask our server guy and I am not allowed to give the information :(
It just makes it even harder to find the solution.

Corvin - How will it work then? I thought it would redirect the users...

All the best
Morten
 

Jake Bunce

XenForo moderator
Staff member
#16
Hi Jake that is so kind of you. I ask our server guy and I am not allowed to give the information :(
That's understandable. But I am certain that I could get it working if you give me access. I have setup redirects for many sites.

The problem with redirects is that there are many points of failure.
 

MagnusB

Well-known member
#17
Hi Jake that is so kind of you. I ask our server guy and I am not allowed to give the information :(
It just makes it even harder to find the solution.

Corvin - How will it work then? I thought it would redirect the users...

All the best
Morten
Seems you got it working now :)

Just wanted to let you know, I discovered that since phpBB generates so many double URL's, there is one more rule you might want to consider adding:

Code:
        RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /posts/%2? [L,R=301,NC]
That one will redirect direct links to posts, not threads, to Xenforo (e.g. viewtopic.php?f=1&p=1). I think I semi understood Corvin's original rule, and it seems to work on my site.
 

Hilmer

Active member
#18
Jake you are the man:) Thanks for fixing it all for me - thats amazing.
I am so glad I got the permission to let you enter our server (y)