Few web developers will deny that URLs based on keywords rather than numbers and meaningless strings make your urls prettier, more descriptive, and more attractive to search engines and humans alike. However, with the tons of options in how to implement SEF urls in your Joomla website it can be confusing on where to start. This post covers how to implement near-perfect SEF URLs with core joomla sef and the core content component.

How Standard Joomla URLs Work

Core Joomla URLs are all built off of the base "index.php" with various strings added to specify the content displayed from the database. These strings represent the component being accessed, the specific item being accessed from that component, and the view for the display.

For example, your homepage might be "http://www.example.com/index.php". To display a specific article from Joomla's content component, the simplest URL would include the name of the component (com_content), the view (single article) and the article's ID number:

http://www.example.com/index.php?option=com_content&view=article&id=23

The Itemid

There are multiple ways by which you could arrive at a particular article, and thus different ways that the URL can be displayed and different strings that can be appended to add in more information. One of the most important parts of a URL is the Itemid, which represents the menu item used to access the specific URL. Itemids for specific articles are "inherited" from the Itemid for the menu item that shows their category and/or section view.

Since Joomla modules are assigned to menu items, any page with the same "Itemid" in the URL will have have the same modules published to it. This is why you will usually have the same modules published to an individual article's page as appear on that article's category page.

You create a new Itemid when you create a menu item that links to anything. Core Joomla SEF URLs will not work correctly unless you have created category menu items for every category in your site. For example, your URL for a category blog layout page may look like this:

http://www.example.com/index.php?option=com_content&layout=blog&view=category&id=6&Itemid=53

This URL contains the component to be accessed (com_content), view (category blog layout), specific category (ID 6) and menu item's ID (Itemid 53).

How Joomla SEF URLs Work

With SEF URLs turned on Joomla uses the aliases of various parts of the URL to rewrite a "Search Engine Friendly" version of the core Joomla URL. Careful wording of aliases will allow you to specify the keywords that show up in URLs when you know how the URLs themselves are assembled.

In Joomla, most elements like menu items, categories, and articles have both a "title" and a "title alias". The alias is an all-lowercase version of the title with no spaces or special characters. An article title like "Using SEF URLs with Core Joomla CMS" would have an alias like "using-sef-urls-with-core-joomla-cms".

So the standard URL for a category blog view menu item for the "Joomla News" category:

http://www.example.com/index.php?option=com_content&layout=blog&view=category&id=6&Itemid=5

would be rewritten as an SEF URL to:

http://www.example.com/joomla-news

assuming that the alias of the menu item is "joomla-news".

Further, for an article in the Joomla News category called "New Version of Joomla Released":

http://www.example.com/index.php?option=com_content&catid=6&view=article&id=124&Itemid=5

would be rewritten as an SEF URL to:

http://www.example.com/joomla-news/124-new-version-of-joomla-released

where "124" is the article's ID and "new-version-of-joomla-released" is the article's title alias.

How to Properly Enable SEF URLs

The first step is organizing your menu structure carefully. In this case that will mean creating category menu items in your main menu for each category (like this site). Then, go to your Joomla Global Configuration and set the parameters "Search Engine Friendly URLs" and "use apache mod_rewrite" to "yes". Your SEF URLs should then work properly.

Doctor's Orders

There are a ton of procedures to follow when using SEF URLs on a Joomla website and this post covers only the basics. Make sure you pay attention to title aliases and menu structure as you build your site and add content. You will likely go on to use an SEF extension like sh404 to refine your URLs but proper understanding of the basics is important. Stay tuned for more posts on how to get the most out of Joomla SEF urls.

Jesse DundonJesse Dundon is a founding partner at Hathway Tech, where he is responsible for project management, training, and overall business strategy. He is a graduate of Cal Poly San Luis Obispo, avid rugby player, and a true scholar of Joomla! and web development in general.


Like this? Tweet it to your followers!

Latest articles from Jesse Dundon

Latest 'tweets' from JomDoc.com

  • Do you use SEF URLs with your Joomla site? Check out this very important post on how do save time in the long run: http://bit.ly/6nvSfv Link Wednesday, 25 November 2009 21:23
  • New Blog: Selecting a Professional Joomla Theme http://tinyurl.com/ykokson Link Monday, 16 November 2009 23:58
  • Cloning a Joomla site for development - not that hard. See the tutorial on JomDoc.com: http://tinyurl.com/yfdzzqh Link Sunday, 15 November 2009 19:28
  • Virtuemart + authorize.net customer information manager = secure customer data storage Link Monday, 09 November 2009 21:02
  • Looking forward to some improvements on the company site. Link Saturday, 07 November 2009 23:17
blog comments powered by Disqus

Getting by with a little help from our friends...

The Doctor recommends Rockettheme if you want a powerful and adaptable Joomla template