Page 1 of 1

Redirect MyBB urls to phpBB urls via .htaccess [Solved]

Posted: Wed Sep 07, 2016 4:11 pm
by umarizal
Dear friends, I migrated from MyBB to phpBB and would redirect via .htaccess the urls in this way:

Example:
Old MyBB: "http://www.terraplenagem.net/forum/show ... hp?tid=146"
to...
New phpBB: "http://www.terraplenagem.net/forum/viewtopic.php?t=146"

And other urls as to show forum, to show post...

Can someone help me?

Thank you ;-)

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Wed Sep 07, 2016 7:38 pm
by Mick
So, basically, you want to swap showthread for viewtopic?

What instructions did you follow (a link is good) for your conversion?

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Wed Sep 07, 2016 8:02 pm
by umarizal
Mick wrote:So, basically, you want to swap showthread for viewtopic?

What instructions did you follow (a link is good) for your conversion?
I want to redirect all link like "/forum/showthread.php?tid=X" to "/forum/viewtopic.php?t=X" where X is topic ID.

Thank you ;-)

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Thu Sep 08, 2016 12:35 pm
by umarizal
I made it in root .htaccess:
RewriteEngine on
RewriteRule /forum/showthread.php?tid=(.*) /forum/viewtopic.php?t=$1 [R=301,L]
phpBB show: No route found for "GET /showthread.php"

But don´t work :(

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Thu Sep 08, 2016 12:44 pm
by .m.
phpBB uses below Rewrite rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]
you can try adding RewriteCond %{REQUEST_FILENAME} !showthread.php
above RewriteRule ^(.*)$ app.php [QSA,L] and check if your redirection rule works ..

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Thu Sep 08, 2016 12:45 pm
by stevemaury
What does "migraate" mean? Did you use a convertor?

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Thu Sep 08, 2016 12:59 pm
by umarizal
stevemaury wrote:What does "migraate" mean? Did you use a convertor?
Yes :D
.m. wrote:phpBB uses below Rewrite rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]
you can try adding RewriteCond %{REQUEST_FILENAME} !showthread.php
above RewriteRule ^(.*)$ app.php [QSA,L] and check if your redirection rule works ..
Don´t work :(

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Thu Sep 08, 2016 1:12 pm
by .m.
No route found for "GET /showthread.php"
after adding suggested rule, did you still get above message ?

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Thu Sep 08, 2016 9:13 pm
by umarizal
.m. wrote:
No route found for "GET /showthread.php"
after adding suggested rule, did you still get above message ?
No, after I received 404 error...

Re: Redirect MyBB urls to phpBB urls via .htaccess

Posted: Sun Sep 11, 2016 7:18 pm
by umarizal
A friend helped me through this tip that solved my problem:

a) Create a file "showthread.php":

Code: Select all

<meta http-equiv="refresh" content="0;URL= http://www.terraplenagem.net/forum/viewtopic.php?t=<?php echo $_GET['tid'];?>">
or

b) .htaccess of phpBB folder:

Code: Select all

RewriteEngine On
RewriteCond %{QUERY_STRING} ^tid=([0-9]+).*$
RewriteRule ^showthread.php$ http://www.terraplenagem.net/forum/viewtopic.php?t=%1 [R=301,L]
Thank all, solved!