Advertisement:

Author Topic: repairing unbridged URLs with htaccess  (Read 9555 times)

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
repairing unbridged URLs with htaccess
« 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...

Code: [Select]
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?

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: repairing unbridged URLs with htaccess
« Reply #1 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.
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline kai920

  • Sr. Member
  • ****
  • Posts: 855
  • Gender: Male
  • its != it's
Re: repairing unbridged URLs with htaccess
« Reply #2 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.

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
Re: repairing unbridged URLs with htaccess
« Reply #3 on: August 06, 2009, 03:12:12 PM »
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.

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: repairing unbridged URLs with htaccess
« Reply #4 on: August 06, 2009, 03:35:49 PM »
This isn't .htaccess, but it should do the job.

Put this in index.php:

Code: [Select]
<?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
« Last Edit: August 06, 2009, 03:41:44 PM by H »
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline krick

  • Jr. Member
  • **
  • Posts: 173
    • tank + paladin = tankadin
Re: repairing unbridged URLs with htaccess
« Reply #5 on: August 07, 2009, 04:41:30 PM »
This seems to do the trick...

Code: [Select]

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