Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Mambo Bridge Support => Aiheen aloitti: kai920 - kesäkuu 01, 2006, 04:54:36 AP

Otsikko: Change links to com_smf
Kirjoitti: kai920 - kesäkuu 01, 2006, 04:54:36 AP
I've read that using .htaccess redirects is not the best way to accomplish this.

So, How do I change:

http://www.kaitech.hk/forums/index.php?topic=751.0 to its com_smf equivalent:
http://www.kaitech.hk/component/option,com_smf/Itemid,71/topic,751.0

http://www.kaitech.hk/forums/index.php?action=post;topic=751.0 to its com_smf equivalent:
http://www.kaitech.hk/component/option,com_smf/Itemid,71/action,post/topic,751.0/num_replies,0

or

http://www.kaitech.hk/forums/index.php?action=post;topic=745.1 to http://www.kaitech.hk/component/option,com_smf/Itemid,71/action,post/topic,745.0/num_replies,1
Otsikko: Re: Change links to com_smf
Kirjoitti: Orstio - kesäkuu 01, 2006, 06:54:19 AP
I have no idea whether the method to do this will work with the joomlahacks integration.  You will most likely find a better answer at joomlahacks.com.
Otsikko: Re: Change links to com_smf
Kirjoitti: kai920 - kesäkuu 01, 2006, 08:11:50 AP
Thx. I'll try over there, but their server is down at the moment.
Otsikko: Re: Change links to com_smf
Kirjoitti: trippinsweet - kesäkuu 01, 2006, 04:35:39 IP
Where did you read that .htaccess redirects isn't the best way to handle this?

I don't believe there is another way.
Otsikko: Re: Change links to com_smf
Kirjoitti: Orstio - kesäkuu 01, 2006, 09:18:37 IP
LainaaWhere did you read that .htaccess redirects isn't the best way to handle this?

Probably in many topics here.  .htaccess redirects will redirect EVERYTHING away from the specified directory, which means that when the bridge tries to access anything in SMF, it gets redirected away.  That's not typically a desirable behaviour.

LainaaI don't believe there is another way.

There are a number of alternative methods, but this is the suggested method:

http://www.simplemachines.org/community/index.php?topic=81152.msg541379#msg541379
Otsikko: Re: Change links to com_smf
Kirjoitti: kai920 - kesäkuu 02, 2006, 01:29:06 AP

// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=71");}
}


This works; however every SMF link is re-directed to the index of the forum.

In order to redirect http://www.kaitech.hk/forums/index.php?topic=751.0 to its com_smf equivalent:
http://www.kaitech.hk/component/option,com_smf/Itemid,71/topic,751.0

I guess I need an additional if statement in there after  if(!defined('_VALID_MOS'))...

if URL contains "topic=xxx"
then capture value of xxx
and rewrite URL as index.php?option=com_smf&ItemID=71&topic=xxx"
Otsikko: Re: Change links to com_smf
Kirjoitti: kai920 - kesäkuu 07, 2006, 07:49:09 AP
I managed to redirect my links through .htaccess with a bit of help:

# http://www.kaitech.hk/forums/index.php?topic=786.0 to
# http://www.kaitech.hk/index.php?option=com_smf&Itemid=71&topic=786.0

# http://www.kaitech.hk/forums/index.php?action=post;topic=786.2 to
# http://www.kaitech.hk/index.php?option=com_smf&Itemid=71&action=post&topic=786.0&num_replies=2

I suppose I could make them into SEF-links as well... but this works for now.  The redirects ONLY happen if there is a "?topic=xxx" or "?action=post" in the URL...

(for an example, try clicking the "2 comments | Write Comment" links on my frontpage.. compare the URL to the actual URL you are directed to)