A search engine friendly URL means that it can easily be understood by people, and search engine robots. An article's URL is usually made up of 3 sections divided by forward slashes. The domain, the category, and the title of the article. It looks something like this "domain.com/category/article-title".
By having a search engine friendly URL you make it easier for your visitors to navigate your site. Your article will also be placed higher up on the SERP (Search Engine Result Page), since it has more keywords. This article will help you clean up your url if you're using Joomla.
Remember to backup your website regularly, and make copies of files you're about to edit.
SEF URL WITH JOOMLA
It seems like the creators of Joomla doesn't want people to remove the ID for some reason. They pretty much remove the "hack/fix" in every update. I would suggest you just migrate to WordPress, unless you need Joomla for a specific reason. If you find a solution/problem, please share it in the comments, and I'll try to help.
Plugins
SEBLOD can help you with the ID. I haven't tried it myself, but it looks promising. Read their FAQ before you install it. Also read this Forum post about changing the URL ID.
You can look for SEF Joomla extensions here: http://extensions.joomla.org/extensions/site-management/sef
Warning: This guide may cause duplicate content, so if you don't know how to fix that yourself, you should try the extensions.
Notes
- Joomla 2.5.6 - Here's a video tutorial if you would prefer that.
- Joomla 2.5.7+ - There are 2 instances of get('sef_advanced_link', 0). Make sure you changes both.
- Joomla 3.0.2 - Changing get('sef_advanced_link', 0) is all you have to do. (Be aware of duplicate content with the old and the new URL, read comments for more info.)
- This may not work on newer version of Joomla! Try SEBLOD, and changing the URL ID.
- Added Joomla 3.1 - step 4.
Step 1
Joomla 2.5
Copy "components/com_content/router.php" to "/your-template/html", (if you don't have a folder called html, you need to create it.) 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
(Try rewriting the symbols if it doesn't work.)
Change this:
1 | $advanced = $params ->get( 'sef_advanced_link' , 0); |
To this:
1 | $advanced = $params ->get( 'sef_advanced_link' , 1); |
Joomla 3+ - You're done!
Joomla 2.5 - Continue Below
Step 3
Replace this:
1 | if ( strpos ( $segments [0], ':' ) === false) { |
2 | $vars [ 'view' ] = 'article' ; |
3 | $vars [ 'id' ] = (int) $segments [0]; |
4 | return $vars ; |
5 | } |
With This:
1 | /*if (strpos($segments[0], ':') === false) { |
2 | $vars['view'] = 'article'; |
3 | $vars['id'] = (int)$segments[0]; |
4 | return $vars; |
5 | }*/ |
Joomla 2.5 - Done!
Joomla 3.1 - Continue below, thanks to Phuoc Nguyen.
Step 4
You want to edit your router.php file:
From:
1 | ->where( $db ->quoteName( 'alias' ) . ' = ' . $db ->quote( $db ->quote( $segment ))); |
To:
1 | ->where( $db ->quoteName( 'alias' ) . ' = ' . $db ->quote( $segment )); |
Help Section
If it doesn't work, there are a few common mistakes you may want to look into.
I have read some just right stuff here. Definitely price bookmarking for revisiting.
ReplyDeleteI surprise how much effort you set to create such a magnificent informative web site.
Here is my site - http://www.streamingfilmeronline.com/moviestreaming/11386