Its fairly common for a new Joomla site to have a few bugs when Search Engine Friendly URLs are turned on. Examples I’ve come across in the last few weeks have included a "Go to the Top" link breaking, and several links breaking in old versions of GroupJive.
One culprit was to blame: sefRelToAbs.
What is sefRelToAbs?
Its a function that’s created inside /includes/sef.php from lines 383 to 557
How is sefRelToAbs Used?
- It indicates that Joomla’s default links (index.php?) should be changed into Search Engine Friendly URLs. These are examples from Community Builder:
Why Does it Cause Issues?
- Often because people forget to use it. In the example of the "Go to the Top" links, the link was the only part of the site not using SEF URLs and so it was breaking. Simply adding sefRelToAbs before the link was enough to make it work.
- Old components sometimes use it incorrectly. Its not unusual to find just one or two SEF links breaking in a component. If your coding isn’t up to fixing the problem, you can find the troublesome link and try removing sefRelToAbs. Often it will fix the problem.
What Happens to sefRelToAbs in Joomla 1.5?
The function’s name has changed to: josURL and will also help Joomla handle SSL certificates more successfully than it does now. The function will actually contain three variables, one of them dealing with SSL:
- $url : this contains the default URL, for example: index.php?option=com_weblinks
- $ssl : this indicates if the URL should change to https://
- $sef : this indicates if SEF URLs should be used