Why It’s Important to Use SEF in Joomla

We are currently migrating a large Joomla website with many pages to Joomla 2.5. Nearly every page has (unoptimized) links to other pages that look like the following:

index.php?option=com_content&view=article&id=[n]&Itemid=[m]

Although the link above is not that pretty, it’s valid and it works. However, it only works before migrating the website (it will stop working after the migration) for the simple reason that article ids change during the migration (it’s really hard and inconvenient to have the same article ids during the migration).

The problem can be solved by creating a script that does the following:

  • Parse all articles for internal links using regular expressions.
  • Extract the article id of each link.

  • Check the alias (or the title) of the article id in the old jos_content table.

  • Get the id of that article in the new jos_content table based on the alias (or the title).

  • Replace the old id with the new id in each article.

Note that the script above must not be interrupted and must be run in “one-shot”, because if it’s interrupted and then re-run, then the links will point to the wrong articles. If you have many articles and if you’re afraid that the script will get interrupted during run-time, then it’s better to add a temporary field to the jos_content table for the Joomla 2.5 website that is set to 1 when the links in the article are fixed.

If you think that the script above is too slow/too inefficient then you’re right. The script can be enhanced by creating a temporary 1-to-1 table called jos_old_to_new that will contain 2 fields: old_id (which is the id of an article in Joomla 1.5) and new_id (which is the id of the article in the new database), this will prevent the script from doing complex and costly comparisons everytime it tries to find the id of the new article (it will just get it from that table).

Now while explaining the above solution to the system administrator (who was a very technical person) of the website we were migrating, he told us: “Why don’t you just do on-the-fly redirection of all the links? Isn’t that easier?” In other words, he wanted to do the following:

  • Leave the content as it is without changing the links.
  • Get the URL of the new link (based on the id of the equivalent article) when someone clicks on a link in an article that has an id that is less or equal to the last article migrated.

  • Redirect to that URL using a 301 redirect.

We immediately explained to the system administrator that this solution is not efficient and is error prone because if someone makes a manual change to an old article and inserts a new URL then that URL will be assumed as an old URL by the system and it’ll be redirected to another URL (that may or may not exist).

How will using SEF solve the above problem?

If you’re using SEF, then (most likely) you don’t have the id of the article anywhere in the link. You just have its alias, so the links won’t change, and even if they do, then the change will not be in the alias (since aliases remain the same during the migration), so all one needs is to develop a system simple plugin to translate links.

Using SEF is an excellent practice not only for SEO but also to ensure that your links remains the same in the next version of Joomla. Not using SEF will cost you time (it takes about a day or two to migrate links) and money – not to mention, of course, search engine rankings!

If you need help migrating your links on your Joomla website, or you need a professional company to migrate your Joomla website altogether, then look no further. We have migrated hundreds of Joomla sites so far and we can definitely migrate yours (regardless of its size). Just contact us and let us prove to you that we are professional, fast, reliable, and not that expensive!

No comments yet.

Leave a comment