Advertisement:

Author Topic: [htaccess redirect] old phpbb url > new smf url  (Read 18858 times)

Offline Nigh7mar3

  • Newbie
  • *
  • Posts: 3
[htaccess redirect] old phpbb url > new smf url
« on: May 13, 2007, 11:36:33 AM »
How many of us convert their board from phpbb to smf and lose all the hard work on google?  >:(

I wrote a little piece of solution. ;)

Its not complete but it works for the more important urls

It redirect these pages to new urls
  • forums
  • topics
  • members profile
  • profile page
  • search
  • members list
  • faq
  • pm
  • online members

Code: [Select]
RewriteEngine On
RewriteCond %{QUERY_STRING} ^f=([0-9]+).*$
RewriteRule ^viewforum.php$ /forums/index.php?board=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^t=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forums/index.php?topic=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^mode=viewprofile&u=([0-9]+)$
RewriteRule ^profile.php$ /forums/index.php?action=profile;u=%1 [R=301,L,NE]
#
RewriteRule ^search.php$ /forums/index.php?action=search [R=301,L]
RewriteRule ^profile.php$ /forums/index.php?action=profile [R=301,L]
RewriteRule ^faq.php$ /forums/index.php?action=help [R=301,L]
RewriteRule ^privmsg.php$ /forums/index.php?action=pm [R=301,L]
RewriteRule ^memberlist.php$ /forums/index.php?action=mlist [R=301,L]
RewriteRule ^viewonline.php$ /forums/index.php?action=who [R=301,L]

Mine phpbb installation is in foo.com/forum and I redirect to foo.com/forums, the smf dir

So, you need only to create .htaccess file in your old phpbb directory, and copy this code in it. Rember to change the word forums to your SMF location.

Live example
Forum Index Url:
hxxp:userbarmaker.com/forum/ [nonactive]

Forum Url:
hxxp:userbarmaker.com/forum/viewforum.php?f=3 [nonactive]

Topic Url:
hxxp:userbarmaker.com/forum/vietopic.php?t=797 [nonactive]

Cya
« Last Edit: May 29, 2007, 12:44:33 AM by JayBachatero »

Offline madalin

  • Newbie
  • *
  • Posts: 9
  • Gender: Male
    • TG-JIU.ro
Redirect OLD phpBB forum to NEW SMF one via 301 htaccess redirect
« Reply #1 on: May 31, 2007, 11:03:14 AM »
Got pretty urls and still want to fix things ?

Add this to your .htaccess file (in your forum directory)

For example, my old forum (phpBB) was located in a subdirectory /forum (hxxp:www.tg-jiu.ro/forum/ [nonactive]) and my new one is located in the same directory.

So if your OLD forum is /forum and your NEW one is /forums change the /forum/index.php.... to /forums/index....
Code: [Select]
RewriteCond %{QUERY_STRING} ^f=([0-9]+).*$
RewriteRule ^viewforum.php$ /forum/index.php?pretty;board=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^t=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forum/index.php?topic=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^mode=viewprofile&u=([0-9]+)$
RewriteRule ^profile.php$ /forum/index.php?action=profile;u=%1 [R=301,L,NE]
#
RewriteRule ^search.php$ /forum/index.php?action=search [R=301,L]
RewriteRule ^profile.php$ /forum/index.php?action=profile [R=301,L]
RewriteRule ^faq.php$ /forum/index.php?action=help [R=301,L]
RewriteRule ^privmsg.php$ /forum/index.php?action=pm [R=301,L]
RewriteRule ^memberlist.php$ /forum/index.php?action=mlist [R=301,L]
RewriteRule ^viewonline.php$ /forum/index.php?action=who [R=301,L]

L.E: P.S: you can see a working demo by going to
hxxp:www.tg-jiu.ro/forum/viewtopic.php?t=67 [nonactive]
or
hxxp:www.tg-jiu.ro/forum/viewforum.php?f=11 [nonactive]

:)
« Last Edit: May 31, 2007, 11:08:31 AM by madalin »
With great power, comes great responsability.
hxxp:www.tg-jiu.ro [nonactive], and hxxp:www.tg-jiu.ro/forum/ [nonactive]

Offline Nigh7mar3

  • Newbie
  • *
  • Posts: 3
Re: [htaccess redirect] old phpbb url > new smf url
« Reply #2 on: May 31, 2007, 12:53:04 PM »
n1 madalin but you need to fix your forum cause there is the PHPSESID in your urls, its not good.

Offline madalin

  • Newbie
  • *
  • Posts: 9
  • Gender: Male
    • TG-JIU.ro
Re: [htaccess redirect] old phpbb url > new smf url
« Reply #3 on: May 31, 2007, 12:57:26 PM »
The phpsessid always gets appended to the URL the firs time you load a forum. I think :)
With great power, comes great responsability.
hxxp:www.tg-jiu.ro [nonactive], and hxxp:www.tg-jiu.ro/forum/ [nonactive]

Offline armybase.us

  • Newbie
  • *
  • Posts: 9
Re: Redirect OLD phpBB forum to NEW SMF one via 301 htaccess redirect
« Reply #4 on: March 20, 2009, 11:18:44 PM »
Got pretty urls and still want to fix things ?

Add this to your .htaccess file (in your forum directory)

For example, my old forum (phpBB) was located in a subdirectory /forum (hxxp:www.tg-jiu.ro/forum/ [nonactive]) and my new one is located in the same directory.

So if your OLD forum is /forum and your NEW one is /forums change the /forum/index.php.... to /forums/index....
Code: [Select]
RewriteCond %{QUERY_STRING} ^f=([0-9]+).*$
RewriteRule ^viewforum.php$ /forum/index.php?pretty;board=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^t=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forum/index.php?topic=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^mode=viewprofile&u=([0-9]+)$
RewriteRule ^profile.php$ /forum/index.php?action=profile;u=%1 [R=301,L,NE]
#
RewriteRule ^search.php$ /forum/index.php?action=search [R=301,L]
RewriteRule ^profile.php$ /forum/index.php?action=profile [R=301,L]
RewriteRule ^faq.php$ /forum/index.php?action=help [R=301,L]
RewriteRule ^privmsg.php$ /forum/index.php?action=pm [R=301,L]
RewriteRule ^memberlist.php$ /forum/index.php?action=mlist [R=301,L]
RewriteRule ^viewonline.php$ /forum/index.php?action=who [R=301,L]

L.E: P.S: you can see a working demo by going to
hxxp:www.tg-jiu.ro/forum/viewtopic.php?t=67 [nonactive]
or
hxxp:www.tg-jiu.ro/forum/viewforum.php?f=11 [nonactive]

:)

gotcha..gotta try it. I need to redirect 301 those old bad urls to a new pretty one :D

Offline Jesus Friends

  • Semi-Newbie
  • *
  • Posts: 39
  • Gender: Male
  • Peace to world!
    • Jesus Friends
Re: [htaccess redirect] old phpbb url > new smf url
« Reply #5 on: January 15, 2010, 09:22:23 AM »
Many thanks friends ... that was so beautiful and useful for me to keep all archived pages at google and other search engines ...

since there are some important kinds of urls which include forum No. or posts No.
these kinds also need to be redirected such as:

/phpbb/viewtopic.php?f=11&t=1111 >> /smf/index.php?&topic=1111.0
/phpbb/viewtopic.php?f=11&p=111111 >> smf/index.php?&msg=111111.0

I added a suitable solution ... may it will be helpful  ;)

Code: [Select]
RewriteEngine On
RewriteCond %{QUERY_STRING} ^f=([0-9]+).*$
RewriteRule ^viewforum.php$ /forum/index.php?board=%1.0 [R=301,L]
#
RewriteCond %{QUERY_STRING} ^t=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forum/index.php?topic=%1.0 [R=301,L]

#
RewriteCond %{QUERY_STRING} ^f=([0-9]+)&t=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forum/index.php?&topic=%2.0 [R=301,L]

#
RewriteCond %{QUERY_STRING} ^f=([0-9]+)&p=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forum/index.php?msg=%2.0 [R=301,L]

#
RewriteCond %{QUERY_STRING} ^p=([0-9]+).*$
RewriteRule ^viewtopic.php$ /forum/index.php?msg=%1.0 [R=301,L]

#
RewriteCond %{QUERY_STRING} ^mode=viewprofile&u=([0-9]+)$
RewriteRule ^profile.php$ /forum/index.php?action=profile;u=%1 [R=301,L,NE]
#
RewriteRule ^search.php$ /forum/index.php?action=search [R=301,L]
RewriteRule ^profile.php$ /forum/index.php?action=profile [R=301,L]
RewriteRule ^faq.php$ /forum/index.php?action=help [R=301,L]
RewriteRule ^privmsg.php$ /forum/index.php?action=pm [R=301,L]
RewriteRule ^memberlist.php$ /forum/index.php?action=mlist [R=301,L]
RewriteRule ^viewonline.php$ /forum/index.php?action=who [R=301,L]

sorry for my english  :-[
« Last Edit: January 15, 2010, 09:32:00 AM by Jesus Friends »
My SMF version is 2.0 RC3
the link is: www.Jesus-friends.com/forum
The default language is Arabic

I LOVE SMF!

Offline dougiefresh

  • Jr. Member
  • **
  • Posts: 260
Re: [htaccess redirect] old phpbb url > new smf url
« Reply #6 on: July 06, 2013, 04:43:19 PM »
Thank God for this topic!  Otherwise, I would've wasted several hours trying to figure this out!  Thanks!
My Mods - PMs are ok but please not for support, here's why.