Simple Machines Community Forum

SMF Support => Converting to SMF => Topic started by: Adrek on January 18, 2011, 07:50:01 AM

Title: Redirect PHP-Fusion URLs to SMF2 URLs ?
Post by: Adrek on January 18, 2011, 07:50:01 AM
Hi, i don't know if i write this message on right board, but this is question related to conversion - PHP-Fusion to SMF2 RC4

There is way to redirect old urls from PHP-Fusion ( example.com/forum/viewthread.php?forum_id=6&thread_id=1256 ) to new in SMF ( example.com/index.php?topic=1256.0 ) ?

I think that's possible by adding rewrite rules to htaccess - maybe someone got that code and could share here ?
Title: Re: Redirect PHP-Fusion URLs to SMF2 URLs ?
Post by: ThorstenE on January 18, 2011, 09:23:21 AM
I'd use php files instead, simply create a file named viewthread.php and place it in your old PHP-Fusion directory.:
Code (viewthread.php) Select

<?php
//change URL
$location 'http://www.yourdomain.com/index.php';

// do not change anything below this line...
if (isset($_GET['thread_id']))
{
$_GET['thread_id'] = (int) $_GET['thread_id'];
$redirect 'Location: ' $location '?topic=' .  $_GET['thread_id''.0';
//now the redirect
header('HTTP/1.1 301 Moved Permanently'); 
header($redirect);
}
else
{
$redirect 'Location: ' $location;
//now the redirect
header('HTTP/1.1 301 Moved Permanently'); 
header($redirect);
}
?>

$location should be replaced with your URL.