- Posts: 38
COMMUNITY FORUM
K2 SEO issue - Can it be fixed?
- chilly_bang
- Offline
- Junior Member
Please Log in or Create an account to join the conversation.
- Michelle
- Offline
- New Member
- Posts: 3
I tried inserting your hack but nothing changed. I'm not very good at this type of thing. Is there somewhere specific within the category item php file where I should insert the hack? Thanks for the help. This entire thing is extremely frustrating with the duplicate links.
Please Log in or Create an account to join the conversation.
- Yiannis K
- Offline
- New Member
- Posts: 4
chilly_bang wrote: Hi all!
Here the hack to avoid duplicated URLs
For an item:
take the file: components/com_k2/templates/default/item.php from your K2 template. AddFor a category:<?php if ($this->item->link!= JRequest::getURI()) JApplication::redirect($this->item->link,'','' ,true); ?>
take the file
components/com_k2/templates/default/category_item.php from your K2 template. Add<?php $this->original_link = JRoute::_(K2HelperRoute::getCategoryRoute(JRequest::getVar('id'), 0)); if (JRequest::getInt('start') > 0) $this->original_link .= "?start=" . JRequest::getVar('start'); $this->real_link = JRequest::getURI(); if ($this->original_link != $this->real_link) JApplication::redirect($this->original_link,'','' ,true); ?>
The hack will redirect all duplicated urls to the single right one.
Use at your own risc and remember:
with this hack no parameter can be pushed with any url. Your print pages etc will not work anymore (print page will be loaded WITH template).
I couldn't use multiple categories in menu. Returned a 404 error, so I had to remove the categories hack at least..
Please Log in or Create an account to join the conversation.
- Creative Immense
- Offline
- New Member
- Posts: 3
The hack to avoid duplicated URLs from Chilly_bang is working but I still have the item id number in the link.
Is there someone who knows how to remove the item id from the link.
I have for example: http://www.yoursite,com/item/16-joomla-k2-problem-item-id.html but I want it like this http://www.yoursite,com/item/joomla-k2-problem-item-id.html without the item id number.
Please can someone help me?!
Greetings Mike
Please Log in or Create an account to join the conversation.
- Creative Immense
- Offline
- New Member
- Posts: 3
New k2 update and the SEO problem is fixed!!
Everthing works great! Good work k2! :-)
Greetings Mike
Please Log in or Create an account to join the conversation.
- Ganesamoorthy N
- Offline
- New Member
- Posts: 1
Mike wrote: Hello everybody,
New k2 update and the SEO problem is fixed!!
Everthing works great! Good work k2! :-)
Greetings Mike
Could you please mention the version of k2, because i have same issues with the version 2.6.3
Please Log in or Create an account to join the conversation.
- Creative Immense
- Offline
- New Member
- Posts: 3
K2 v2.6.5 but I still have the SEO problem. So I put the fix back in the item.php
Greetings Mike
Please Log in or Create an account to join the conversation.
- Neil Forrester
- Offline
- Junior Member
- Posts: 25
I have been looking into this issue myself and even went down the route of employing someone in htaccess coding skills to rewrite the URL.
After spending too many hours on this I now have it working.
- Back up your site using Akeeba Backup
- Download the latest version of K2 which is currently K2_v2.6.5.zip.
- Remember, if you have made any changes to the K2 CSS files without creating an override they will be written over. So keep any necessary files.
- Install K2_v2.6.5.zip via Extensions Manager
- Now go to Components / K2
- Click the Parameters button top right
- A window opens up - click the Advanced tab
- Scroll down to Advanced SEF Settings
- Enable advanced SEF for K2 URL's - Yes
- Use the item ID in the URL - No
[img size=74kb]www.pixelfire.com.au/images/k2-sef-settings.png[/img]
Save and close.
These settings have worked for me. I wish I had only upgraded my K2 before spending too many bloody hours on this issue. Oh well - it's working fine now and it's great.
Don't forget, if you have a few Items that people access through a category listing you will need to update the redirects for their URL's which I now need to do so I'll have to disable the new SEF until I have a full list of redirects I need to set up.
Example URL change:
www.pixelfire.com.au/website-and-graphic-design-blog/item/121-top-10-joomla-extensions
Now becomes:
www.pixelfire.com.au/website-and-graphic-design-blog/top-10-joomla-extensions
Also this guy at the bottom of this URL has some good ideas for avoiding duplication of URL using the No Numbers Sourcerer and the rel="canonical" tag. It's worth a look.
forum.joomla.org/viewtopic.php?t=624631
Hope that helps.
Cheers,
Neil.
Please Log in or Create an account to join the conversation.
- Neil Forrester
- Offline
- Junior Member
- Posts: 25
www.pixelfire.com.au/website-and-graphic-design-blog/item/122-how-to-remove-item-and-item-id-from-a-k2-url
I hope this helps all of you :)
Good luck.
Please Log in or Create an account to join the conversation.
- Passy
- Offline
- New Member
- Posts: 5
How can remove component/k2/ from my URL
For example:
www.domain.de/component/k2/article
to
www.domain.de/article
Thank you for your help :-)
Please Log in or Create an account to join the conversation.