joomlaexpo: search engine friendly urls - azrul.com
DESCRIPTION
Azrul.com presentation on SEF Search Engine Friendly URLs for JoomlaEXPO 2008 in Chicago, Illinois.TRANSCRIPT
Creating search engine optimized url for your component
Azrul Rahim
www.azrul.com
Why Bother ?
• Search engines analyze your URLs for keywords, and will highlight it in the result
• avoid duplicate content issues• Default Joomla SEF url are very common• URL should be friendly to us, HUMAN.
– Better click through rate– visitor know what to expect
• Make your site looks more professional!
http://www.alledia.com/blog/joomla-urls/in-defense-of-search-engine-friendly-urls/
Joomla 1.0 approach to SEF-url
• 3rd party component required– SEFAdvance– OpenSEF – sh404SEF
• Each one uses different approach
• Need to maintain separate plug-in for each component.
Joomla 1.5 and SEF url
• SEF-url engine comes built-in with every installation of Joomla !– Works with/without mod_rewrite– Nice human-readable url
• Not as flexible as 3rd party component
• No url caching
sef-url in Joomla 1.5
• Backend config
• Specify menu title alias
• Some limitations– No choice over url suffix. One will be assigned
automatically. – Potential multiple link to the same content– If multiple menu item use the same link title,
only the first will be accessible
2 approach in SEF rewriting
• No caching, logic-based syetem.
• create and resolve url on the fly
• Cached url system
1. Non-caching
• (my preferred technique)• Able to resolve url that has never been used
before• Twice the amount of work to develop the plugins• Example
– OpenSEF– sefAdvance– Joomla 1.5 default– SmartSEF
2. Cached url system
• url are created and saved• Little overhead to parse the url, need a single
database call• Normally require only the code to ‘create’ the url• url has to be created first, otherwise it cannot be
resolved• Can break your site, damage your SEO ranking
when cached cleared– sh404SEF
– smartSEF
Creating sef-url for your component
1. Plan your url
2. List down all your required normal url
3. List down how they should look like, SEF-ed
4. Tips1. “Human readable!”
2. Meaningful, with a hint of the content
3. Contain targeted keywords
1. Create a file ‘router.php’ in your component folder
2. Create 2 function within router.php1. function [Com name]BuildRoute( &$query )
2. function [Com name]ParseRoute( $segments)
…BuildRoute(&$query)
• Take a reference to an array
• $query is built from JRoute::_(…) function call, split-up into array
• Return value should be an array, – $segments = array()$segments[]=‘path1';$segments[]='path2';$segments[]='file';
– Will create path1/path2/file.html
• Need to unset all variables that you have assign a segment
Notes & gotchas
• Do not add ‘.html’ to your SEF url, Joomla will add this automatically if required.
• Create a menu entry to use component ‘alias’ . Otherwise, it will show as ‘/components/com_name/…’
• Alias has to be unique. If there is a duplicate, only the first link will be accessible
…ParseRoute($segments)
• Called to resolve the segment-based url to their original url
• Given an array with url segment
• Return array of actual $_GET values
Notes…
• Joomla convert the first dash ‘-’ to ‘:’
• There is no reliable way to encode/decode url that might contain combination of dash and double colon
• Where do we specify Itemid ? . Don’t worry, menu alias will take care of it!
Other alternative
• SmartSEF (www.smartsef.org)– Each sef plugin can have their own params– Sitemap support– Some security check
• SEFAdvance• Sh404
– H1 tags
• SEF Patch (joomlatwork.com)– (metadata/no-follow)
Questions & Discussions
Please ask questions…
www.azrul.com