Advertisement:

Author Topic: Old URLs after migration  (Read 4818 times)

Offline Belford

  • Semi-Newbie
  • *
  • Posts: 12
Old URLs after migration
« on: February 18, 2012, 06:09:32 AM »
Hello!

Is there a relatively fast method, which would redirect about 50 thousand results associated with the old script forum for those associated with the SMF?

You know, that link are quite different, and updating the results of the search will take a long time.

What did you do in a similar situation?


ThorstenE

  • Guest
Re: Old URLs after migration
« Reply #1 on: February 18, 2012, 06:14:22 AM »
depends on the source forum, respective the old URLs, you might wanna check:
http://www.simplemachines.org/community/index.php?topic=170959.msg1090792#msg1090792

Offline Oldiesmann

  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 24,100
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Old URLs after migration
« Reply #2 on: February 18, 2012, 03:14:06 PM »
Which forum system did you convert from?

Offline Belford

  • Semi-Newbie
  • *
  • Posts: 12
Re: Old URLs after migration
« Reply #3 on: February 21, 2012, 10:45:33 AM »
From phpBB 2.

@TE
Thanks for your reply, but what with subdomains?
I mean it will redirect example.com/community correctly, but how to prepare .htaccess document which can do the same for community.example.com? Now it will change last one for community.example.com/community what does nothing.

Offline Belford

  • Semi-Newbie
  • *
  • Posts: 12
Re: Old URLs after migration
« Reply #4 on: March 04, 2012, 01:39:08 PM »
« Last Edit: March 04, 2012, 02:13:50 PM by Belford »

Offline Oldiesmann

  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 24,100
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Old URLs after migration
« Reply #5 on: March 05, 2012, 12:27:00 PM »
The easiest way to do it is to just create "dummy" files - files with the same name as ones in phpBB which simply serve to redirect to the proper SMF URL.

Put these files in the phpBB directory and change them to match your setup (eg "http://www.example.com/smf" would be replaced with the actual URL to your SMF installation).

printview.php:
Code: [Select]
<?php
if (!empty($_GET['t']))
{
    
$topic = (int) $_GET['t'];
    
header('HTTP/1.1 301 Moved Permanently');
    
header('Location: http://www.example.com/smf/index.php?action=printpage;topic=' $topic);
}
?>

viewforum.php:
Code: [Select]
<?php
$start 
= empty($_GET['start']) ? : (int) $_GET['start'];
if(!empty(
$_GET['f']))
{
    
header('HTTP/1.1 301 Moved Permanently');
    
header('Location: http://www.example.com/smf/index.php?board=' . (int) $_GET['f'] . '.' $start);
}
?>

viewtopic.php:
Code: [Select]
<?php
$post 
= empty($_GET['p']) ? (int) $_GET['p'] : 0;
// Jumping to a specific post?
if (!empty($post))
{
    
$location 'msg=' $post;
}
elseif (!empty(
$_GET['t']))
{
    
$start = empty($_GET['start']) ? : (int) $_GET['start'];
    
$location 'topic=' . (int) $_GET['t'] . '.' $start;
}

header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com/smf/index.php?' $location);
?>

Change http://www.example.com/smf to the actual URL for your forum, and place these files in your phpBB directory, overwriting the existing ones.