Advertisement:

Change links to com_smf

Aloittaja kai920, kesäkuu 01, 2006, 04:54:36 AP

« edellinen - seuraava »

Orstio

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.

kai920

Thx. I'll try over there, but their server is down at the moment.

trippinsweet

Where did you read that .htaccess redirects isn't the best way to handle this?

I don't believe there is another way.

Orstio

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

kai920


// 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"

kai920

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)

Advertisement: