News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Old URLs after migration

Started by Belford, February 18, 2012, 06:09:32 AM

Previous topic - Next topic

Belford

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


Oldiesmann

Which forum system did you convert from?
Michael Eshom
Christian Metal Fans

Belford

From phpBB 2.

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

Belford

#4

Oldiesmann

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:
<?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:
<?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:
<?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.
Michael Eshom
Christian Metal Fans

Advertisement: