Advertisement:

Author Topic: Rewriting com_smf URLs to standalone URLS  (Read 21476 times)

Offline desquinn

  • Semi-Newbie
  • *
  • Posts: 33
Rewriting com_smf URLs to standalone URLS
« on: January 25, 2008, 10:57:50 PM »
Hi,

Is there a method for rewriting com_smf urls to standalone "community/index.php?topic=58.0" type urls. Either a mod_rewrite or a database update method would be great.

I have swapped from joomla bridged to standalone and want to handle url's embedded in messages.

TIA

regards
Des Quinn

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,752
  • Gender: Male
    • Kindred-999 on GitHub
Re: Rewriting com_smf URLs to standalone URLS
« Reply #1 on: January 25, 2008, 11:01:54 PM »
do the reverse of the database change that Goosemoose provided (listed in the combines readme thread)
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline desquinn

  • Semi-Newbie
  • *
  • Posts: 33
Re: Rewriting com_smf URLs to standalone URLS
« Reply #2 on: January 25, 2008, 11:07:20 PM »
I had looked at that and thought that it was something like that but to be honest my eyes are failing and brain is confused :(

I might be better at it in the morning but any help / guidance that you can give would be great. Was unsure of doing anything like that without have some sor tof limit on it so that any mistakes are limited to one post for example

in case it helps the urls in question are as follows:

old URL:
http://www.domain.org/component/option,com_smf/Itemid,83/topic,3402.0

New URL
http://www.domain.org/community/index.php?topic=3402.0

any clarification would be great but I think that the thought of sleep is starting to win me over :)




Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,752
  • Gender: Male
    • Kindred-999 on GitHub
Re: Rewriting com_smf URLs to standalone URLS
« Reply #3 on: January 26, 2008, 08:18:27 AM »
FIXING LINKS IN SMF MESSAGES FROM PRE-BRIDGED FORUMS

(thanks to Goosemoose for this)
If you were running a forum prior to bridging it with mambo/joomla, there will be links in
messages that point to the unbridged forum location. You can change these by going
into phpMyAdmin and running a simple SQL command on the smf_messages table.

The format is:

Code: [Select]
UPDATE smf_messages SET `body` = replace(`body`,"http://www.yoursite.com/forum/index.php?","http://www.yoursite.com/mambo/index.php?option=com_smf&Itemid=##&")

where smf_messages is your actual table (change the smf_ if you are using a different
prefix, obviously)
where http://www.yoursite.com/forum/index.php is the actual URL of your previous
(unbridged) SMF index.php.
where http://www.yoursite.com/mambo/index.php is the actual location of your MAMBO/JOOMLA
index.php
where Itemid=## is your actual SMF component Itemid

so, an example, (as provided by Goosemoose)

Code: [Select]
UPDATE rfc_messages SET `body` = replace(`body`,"http://www.goosemoose.com/rfc/index.php?topic=","http://www.goosemoose.com/index.php?option=com_smf&Itemid=70&topic=")

He used rfc_ as his SMF database table prefix and rfc was the SMF directory.
note that his mambo is installed in the root directory...



so, instead you want to do:

Code: [Select]
UPDATE smf_messages SET `body` = replace(`body`,"http://www.yoursite.com/component/option,com_smf/Itemid,83/","http://www.yoursite.com/community/index.php?")
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline desquinn

  • Semi-Newbie
  • *
  • Posts: 33
Re: Rewriting com_smf URLs to standalone URLS
« Reply #4 on: February 19, 2008, 04:10:25 AM »
Just realised I forgot to say thanks for this help.

cheers.

Offline arillas

  • Semi-Newbie
  • *
  • Posts: 56
Re: Rewriting com_smf URLs to standalone URLS
« Reply #5 on: February 24, 2008, 02:18:15 PM »
so, instead you want to do:

Code: [Select]
UPDATE smf_messages SET `body` = replace(`body`,"http://www.yoursite.com/component/option,com_smf/Itemid,83/","http://www.yoursite.com/community/index.php?")
[/quote]

That looks right but When we have unbridged our forum and we are using joomla and smf standalone then we need to create/rewrite links like /joomlafolder/option,com_smf/Itemid,83/   in to /forumfolder/index.php?topic=3402.0 etc.
in that case if I want to run the above sql command there is no such a table in my joomla database.
how can we prevent ALL dead links when we have unbridged our forum from joomla?

cheers,


Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,752
  • Gender: Male
    • Kindred-999 on GitHub
Re: Rewriting com_smf URLs to standalone URLS
« Reply #6 on: February 24, 2008, 08:13:46 PM »
I don't really understand what you are asking.

the table to run that query on is in your SMF database, and the code that I posted will change all bridged links to unbridged links.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline forumnoob

  • Jr. Member
  • **
  • Posts: 114
Re: Rewriting com_smf URLs to standalone URLS
« Reply #7 on: March 11, 2008, 01:09:44 PM »
I think he's looking for MOD REWRITE rules to apply, ideally with a 301 (moved code) so Google et al, stop looking for the 'old links'

Offline kai920

  • Sr. Member
  • ****
  • Posts: 855
  • Gender: Male
  • its != it's
Re: Rewriting com_smf URLs to standalone URLS
« Reply #8 on: June 06, 2008, 01:03:14 AM »
I think he's looking for MOD REWRITE rules to apply, ideally with a 301 (moved code) so Google et al, stop looking for the 'old links'

Has anyone come up with some good htaccess rules for rewriting bridged URLs to standalone URLs?
I remember I did it the other way before, but this would be a little different.

Offline kai920

  • Sr. Member
  • ****
  • Posts: 855
  • Gender: Male
  • its != it's
Re: Rewriting com_smf URLs to standalone URLS
« Reply #9 on: July 28, 2009, 09:37:52 PM »
Kindred,

The bit of code you provided works with Joomla SEF disabled, but my URLs are of this type:

http://www.domain.com/component/option,com_smf/Itemid,71/topic,187.0

So, in addition to changing
http://www.domain.com/component/option,com_smf/Itemid,71/
to
http://www.domain.com/forums/index.php?

I also need to change topic,187.0 to topic=187.0

Any ideas how this can be achieved?

Thanks!

EDIT: nevermind, I was dumb... just need to add topic, and replace it with topic=
« Last Edit: July 29, 2009, 07:24:27 AM by kai920 »