You have your SEF URLs turned on for your Joomla website and they look great and are chalk-full of keywords, but now you want to create some internal links between pages on your site. It is as simple as copying the link from the toolbar and using your WYSIWYG to add the link, right? Wrong! In this quick followup to a recent article on Joomla SEF URLs we will cover how to properly set up internal links with SEF URLs turned on and review a quick tool from Joomlapraise called PraiseURL.
SEF URLs - Brief Overview
SEF URLs work in Joomla by "rewriting" urls like mysite.com/index.php?option=com_content&view=article&id=99 to something meaningful and easier to understand like mysite.com/company-news/new-store-opening-in-march. SEF URLs are critical for both search engines to see keywords and for users to understand what content they will see when the click a link (a preview, if you will). The system will automatically rewrite dynamic links (from menus) and internal links (in content and modules).
Internal Linking
Let's say you are writing a blog post like I am right now and want to reference another article. In this case I wanted to link to the article "Using SEF URLs with Core Joomla CMS". Since I have SEF URLs turned on, the link I see in my browser is:
http://jomdoc.com/joomla-administration-blogs/using-sef-urls-with-core-joomla-cms
It seems as simple as copying the relative link (everthing after the trailing slash at the end of your domain name) and using that link in your article. True, this will work right away and may continue to work forever. But let's just say that you change your SEF program a month from now, update the article title, or change the category name? Your SEF URL will change, and the SEF links within your content will be broken! Good luck spending your weekend checking and fixing every single internal link on your site...
Proper Internal Linking with Joomla SEF URLs Turned On
The solution is actually quite simple when you have the correct tools. All you need to do is grab the relative dynamic URL, that ampersand questionmark com_whatever one Joomla uses when SEFs are turned off (and the one it still uses with SEFs are turned on, but behind the scenes). But how can you get that URL when all you can see is the SEF URL?
Solution 1: Turn off SEF URLs temporarily
Easy. Just go to your global config and turn off SEF URLs and disable them in whatever other SEF program you are using like sh404 or AceSEF. Go to the frontend, navigate to the page you want to link to, copy the URL from the address bar of your browser, and use that for your new internal link.
Solution 2: Use a "URL Revealer" like PraiseURL
This is also easy, in fact so easy that you won't go back to the first method once you have this one figured out! The folks over at JoomlaPraise have created a module called PraiseURL that shows you the "server request" URL on any page, even when SEF URLs are turned on. The server request URL is that dynamic url we have been talking about, the one that is not very likely to change because it directly accesses the database.
- Download the module and install it
- Publish it to an inconspicuous position for "special" access so only admins and authors can see it and it doesn't get in the way.
- Navigate to your desired target page (make sure you are logged in)
- Copy the "server request URL" and use that one for your link (leave the leading slash out for relative links, I'll cover relative linking in more detail in a future post)
- Finish your new article and check it out on the frontend. Even though you used the dynamic URL in your link, Joomla has already rewritten it as its equivalent SEF URL! Your users won't know the difference, but you will be saving yourself a world of hurt down the line. The rewriting takes place when the content is rendered in the browser, but your article still stores the dynamic URL.
joomla-administration-blogs/using-sef-urls-with-core-joomla-cms
as my relative internal link, I use the non-sef dynamic version that I pulled from PraiseURL:
index.php?option=com_content&Itemid=181&catid=37&id=80&lang=en&view=article
Doctor's Orders
Improper usage of SEF URLs is something that I see far to often, even with experienced Joomla admins for whom I do consulting over at my day job. Now that you know how to properly set up your internal links, you have no excuse not to do it properly for each and every one. The extra two seconds it takes initially will save you loads of time down the line.




Jesse Dundon is a founding partner at 
