repairing unbridged URLs with htaccess

Started by krick, June 04, 2009, 10:36:50 PM

Previous topic - Next topic

krick

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?

H

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.
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

kai920

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.

krick

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.

H

#4
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
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

krick

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]


Advertisement: