Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Joomla Bridge Support => Topic started by: krick on June 04, 2009, 10:36:50 PM

Title: repairing unbridged URLs with htaccess
Post by: krick on June 04, 2009, 10:36:50 PM
I have some old bridged joomla/smf URLs floating around that I'd like to permanently re-direct to the correct URLs.

OLD URL:   http://www.tankadin.com/index.php?option=com_smf&Itemid=39&topic=134.msg735
NEW URL:   http://www.tankadin.com/forum/index.php?topic=134.msg735

This is what I've come up with to put in my .htaccess file based on other RewriteRules that I have that are working, however it doesn't work and I suspect that I have something subtle about the syntax messed up...

RewriteRule ^index.php?option=com_smf&Itemid=39&(.*)$ http://www.tankadin.com/forum/index.php?$1 [L,R=301]


Can anyone point me in the right direction?
Title: Re: repairing unbridged URLs with htaccess
Post by: H on June 27, 2009, 11:08:32 AM
krick, do you still need help with this?

I'm not particularly good with rewrite rules. Another thing you could look at would be to add a bit of code to /index.php which just extracts the topic= and redirects to the relevant SMF url.
Title: Re: repairing unbridged URLs with htaccess
Post by: kai920 on July 28, 2009, 09:23:22 PM
H,

I still need help with this if you have any ideas. I remember a LONG time ago I had some htaccess rules that redirected from standalone forum to bridged, but am now looking to do the opposite. The only difference to krick's situation is that mine were SEF Joomla URLs.
Title: Re: repairing unbridged URLs with htaccess
Post by: krick on August 06, 2009, 03:12:12 PM
Quote from: H on June 27, 2009, 11:08:32 AM
krick, do you still need help with this?

I'm not particularly good with rewrite rules. Another thing you could look at would be to add a bit of code to /index.php which just extracts the topic= and redirects to the relevant SMF url.

Yes, I still have a bunch of old bridged URLs floating around on the web that I'd love to redirect to the current unbridged URLs.  I was never able to get the htaccess rewrite working for some reason.
Title: Re: repairing unbridged URLs with htaccess
Post by: H on August 06, 2009, 03:35:49 PM
This isn't .htaccess, but it should do the job.

Put this in index.php:

<?php
if(isset($_GET['option']) && $_GET['option'] == 'com_smf')
{
$url '/index.php';
if(isset(
$_GET['topic']))
$url .= '?topic='$_GET['topic'] .'';

header("HTTP/1.1 301 Moved Permanently");
header('Location: '$url .'');
header("Connection: close");
}
?>


/edit: This line:

$url = '/index.php';

Will need to be modified to wherever your forum is. For example, /forum/index.php
Title: Re: repairing unbridged URLs with htaccess
Post by: krick on August 07, 2009, 04:41:30 PM
This seems to do the trick...



RewriteCond %{QUERY_STRING} ^option=com_smf&Itemid=39&(.*)$
RewriteRule ^index.php http://www.tankadin.com/forum/index.php?%1 [L,R=301]