0

Is it possible to get SEF URL from Joomla article ID through some API?

I'm moving data from old custom CMS to Joomla. Articles in old CMS contain links to each other.

Old articles had their full URL in the database table and while importing them into Joomla I've also saved new Joomla article ID.

So now I have mapping between old CMS article URL and new Joomla article ID.

To fix those old links in article content I need to get new Joomla article URL from ID.

1 Answer 1

1

It's a bit unclear what's your exact goal and how you are going to use whatever possible answer you are going to get. Will you have all previous SEF URLs changed? Will you do a search and replace inside the database for all old links of the content? And how you could combine a possible API usage with the database operations.

I think the whole task needs a good plan on how this migration/transformation should be done, considering the content, the urls and how the new URLs structure will look like...

But anyway, if we focus only on how to link to other articles from inside an article in Joomla, I would recommend to use non-sef URLs inside your content, instead of SEF ones.

The non-SEF would convert to SEF once you enable SEF URLs on Joomla.

An example of how a non-SEF URL link to another article, from inside an article would be like:

index.php?option=com_content&view=article&id=113

Or if you would want to include the Category ID:

index.php?option=com_content&view=article&id=113&catid=145

Or also include the language:

index.php?option=com_content&view=article&id=113&catid=145&lang=en-GB

So, if I had to update all internal articles links to other Joomla articles, this is how my new links would like.


Update: I would also consider to install a SEF extension like sh404SEF to help managing all the new SEF URLs more efficiently.

3
  • Ah yes, I forgot about that. I'm assuming I can get category SEF URL by writing index.php?option=com_content&view=category&id=145?
    – Reygoch
    Commented May 15, 2019 at 20:26
  • That would work, but you may want to also specify the layout of the category like so: index.php?option=com_content&view=category&layout=blog&id=145 @Reygoch
    – FFrewin
    Commented May 15, 2019 at 20:40
  • @Reygoch: I would also consider to install a SEF extension like sh404SEF to help managing all the new SEF URLs more efficiently.
    – FFrewin
    Commented May 15, 2019 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.