
Having a URL that looks “friendly” in the eyes of a search engine, and logical to visitors, is an important factor in SEO. Your URL probably look like this, example.com/5/article. This “SEF” -guide will make it look like this, example.com/article.
It’s actually not hard to do, we won’t be installing any plugins or modules, just change 2 numbers (and comment out a paragraph). Remember it’s always good to make a copy of the file you’re working on, if you do something by mistake, it would be easy to change back.
Get a SEF URL with Joomla
If you want to remove the ID number from your Joomla URL, this is the guide for you. It works with Joomla 2.5.6 & 2.5.7 & (thanks to James) – 3.0.2.
- Note: Joomla 2.5.6 - Here’s a video tutorial if you would prefer that.
- Note: Joomla 2.5.7 – There are 2 instances of get(‘sef_advanced_link’, 0).
- Note: Joomla 3.0.2 – Changing get(‘sef_advanced_link’, 0) is all you have to do.
Step 1
Joomla 2.5
Copy “components/com_content/router.php” to “/your-template/html”, then continue on step 2.
Joomla 3.0.2: This is the only way I got it working. If you find another way, please let us know!
Edit “components/com_content/router.php“, then continue on step 2.
Remember, you’ll probably have to re-do this step every time you update Joomla.
Step 2
Replace this:
$advanced = $params->get('sef_advanced_link', 0);
With this:
$advanced = $params->get('sef_advanced_link', 1);
Joomla 3 – You’re done!
Joomla 2.5 – Continue Below
Step 3
Replace this:
if (strpos($segments[0], ':') === false) { $vars['view'] = 'article'; $vars['id'] = (int)$segments[0]; return $vars; }
With This:
/*if (strpos($segments[0], ':') === false) { $vars['view'] = 'article'; $vars['id'] = (int)$segments[0]; return $vars; }*/