Remove article id from url for joomla 3.0

Discuss Search Engine Optimization in relation to Joomla! 3.x. This forum will also have discussions on SEF/SEO Joomla! 3.x extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
User avatar
sounds
Joomla! Explorer
Joomla! Explorer
Posts: 357
Joined: Tue Jun 12, 2007 7:20 am
Location: Republic of Ireland

Re: Remove article id from url for joomla 3.0

Postby sounds » Wed Jan 28, 2015 11:42 pm

I think there are a lot of joomla users that don't want to hack the code every time joomla chances.
That's probably the main reason I would use a small extension to fix some issues if needed.
You have me thinking though, in some templates you can create a custom css file and
add all your alterations into that so your changes still work if the theme files are updated.
I wouldn't like to have to do that in joomla every time though, but i guess that's how you
build a customized design.
Big party when I reach 10,000 posts.

Thank you :pop:

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Wed Jan 28, 2015 11:55 pm

The problem is that even if you figure out the right way to over ride it (I've tried with no luck) in your template, the file itself often needs changes with new updates due to router changes in Joomla. So yeah, I could certainly understand why most would not want to go this route. However for me speed for my viewers is important for both the user experience and SEO.

User avatar
ShibumiDesign
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Jan 17, 2012 2:56 pm
Location: Ottawa, ON, Canada
Contact:

Re: Remove article id from url for joomla 3.0

Postby ShibumiDesign » Thu Jan 29, 2015 12:09 am

I guess with that being said, you could still place the modified copy of the router.php file in your template override folder as mentioned above, and just copy it back into the original components/com_content folder after each Joomla update, overwritting the Joomla updated file
http://ShibumiDesignStudios.com
Shibumi: Effortless Perfectiom

User avatar
Gasoline
Joomla! Explorer
Joomla! Explorer
Posts: 408
Joined: Tue Aug 23, 2005 10:33 am
Location: NL
Contact:

Re: Remove article id from url for joomla 3.0

Postby Gasoline » Tue Feb 10, 2015 4:12 pm

sortby wrote:Hello,
I have tried the method and it works.....BUT
it duplicate the urls: one with ID and another without ...like the example:
/cat/article.html
/cat/24-article.html

both are working.... >:(

I think this is very bad for SEO purpose (and i think remove the ID is mostly for SEO purpose)

So...how to solve this???

Thanks in advance!


Just leave your site as it is, it has no influence on SEO. Google "inderstands" Joomla. Make a good site with great content and structure and yo'r fine.
https://websitezeist.nl
Websites - Webshops - SEO
Fast, Safe & Hassle free!

doubleV
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Mar 09, 2015 3:46 pm

Re: Remove article id from url for joomla 3.0

Postby doubleV » Wed Mar 11, 2015 1:54 pm

so.. conclusion: in the latest version, still article number and still have to fix it as said in the first post?
(except for the last step in the latest version?)
correct?

if i have an older version you say, always have to do it again after update, is this a minor changes update or a full upgrade? to a new version?

kind regards

doubleV
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Mar 09, 2015 3:46 pm

Re: Remove article id from url for joomla 3.0

Postby doubleV » Wed Mar 11, 2015 2:39 pm

because in joomla 3.3.6 it isnt working for me like explained..

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Wed Mar 11, 2015 7:19 pm

For Joomla 3.4.0 I'm using step 1 and 2 from the following page:
http://joomla.stackexchange.com/questio ... ers-header

It's working like a charm without any need for an SEF extension as seen here: http://www.alpineascent.com/trip-report

doubleV
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Mar 09, 2015 3:46 pm

Re: Remove article id from url for joomla 3.0

Postby doubleV » Wed Mar 11, 2015 9:16 pm

OK thanks for the reply,

in my case i have a joomla set just for running 1 extension (checkout page for selling a license)...
it is set in an subfolder like pay.mydomain.com
now i just want to have my page visible at pay.mydomain.com/cashout/cashout
for some special clients i want some special price arrangements and they will have other pages..
but i dont want anyone to get on these pages bij guessing numbers like pay.mydomain.com/2/3/ and reach a page dat isn't allowed to acces for 'strangers'.

so in 3.3.x it's complicated and for 3.4 it works fine?

just to be clear for that link step 1 is opening your router file?
then just change the variables as said in step 2?

ill try it in a few days by installing 3.4

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Wed Mar 11, 2015 9:34 pm

The method above only applies to Joomla articles. Joomla 3.5 should have better standards regarding general ids. Keep in mind that even when that happens, extension developers will need to change their code to use idless url's. But that issue only applies to extensions (components) outside of the core of Joomla.

It wasn't complicated with Joomla 3.3. Considering that J 3.4 has a lot of changes and fixes I consider it a good move to make the jump to J 3.4.

just to be clear for that link step 1 is opening your router file?
then just change the variables as said in step 2?


Yes. On step two you will need to change the value to 1 in two different spots as mentioned in the instructions. Keep in mind that the old url will open the same page. So site.com/category/article-54 will also work.

Attached to this message is a zip file that has the router change for Joomla 3.4 to have idless urls for articles. Replace the following file: root/components/com_content/router.php
You do not have the required permissions to view the files attached to this post.

doubleV
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Mar 09, 2015 3:46 pm

Re: Remove article id from url for joomla 3.0

Postby doubleV » Thu Mar 12, 2015 1:52 pm

ok thanks ill try it for a new 3.4 installation..
hmm so mysite/2/4 will still show that article, is there a way to avoid that?

i hope in a new version they just leave article nr behind..

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 18209
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

Re: Remove article id from url for joomla 3.0

Postby leolam » Thu Mar 12, 2015 4:52 pm

Josh Lewis wrote:Attached to this message is a zip file that has the router change for Joomla 3.4 to have idless urls for articles. Replace the following file: root/components/com_content/router.php
Josh, I suggest you have a good look at 10 or so PR's in relation to the router issues with Joomla that are waiting to be merged in the next or so Joomla version since this code of yours is not that 'well coded' and it is a very, very rough and dirty hack which would never see daylight in the Joomla core .... So I would suggest no users in Joomla to implement this 'hack'

Leo 8)
Celebrating 12-Years of Professional Joomla Support Services
- Joomla Professional Support:https://gws-desk.com -
- Joomla Specialized Hosting Solutions:https://gws-host.com -
- Member Joomla Bug Squad & J-CMS Release Team

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Thu Mar 12, 2015 7:26 pm

@leolam: I typically avoid "dirty hacks", however this one seems to be working just fine and is consistent. We both know it's not worthy of being in the core, however it does meet the needs of many of us right now. Any time you hack Joomla it has potential consequences. However I believe in this case the gain outweigh the consequences, especially if I had to choose between an SEF extension that slows down the site or this. Also this hack seems to only affect articles rather than the rest of the site which is comforting in terms of what is effected. From an SEO point of view it's doing quite fine as seen here: https://www.google.com/#safe=off&q=site ... ascent.com

I know about the router PRs long before your post. As I understand it Joomla 3.5 will most likely have idless url's. However some of us don't want to wait that long. The last major release of Joomla took over 9 months.

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Sun Mar 22, 2015 6:54 am

Upgrading to Joomla 3.4.1 did not require me to replace the file considering that the router file was not touched in the update. In addition to this, the mod is still working like a charm. 8)

aboenzli
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 23, 2015 10:44 am

Re: Remove article id from url for joomla 3.0

Postby aboenzli » Tue Mar 24, 2015 9:22 am

I noticed two things: when I apply the hack Josh Lewis posted I get 404 errors on categories with no menu items pointing to them and for articles with just one word as alias I also get 404 errors. If I manually prepend the id of the article/category to the URL it seems to work fine and displays the cat/article.

Commenting out the lines 313-319 of the router.php will fix this. Steps I followed that seem to work fine for me:

1. Search for this code (line 34 and line 287):

Code: Select all

$advanced = $params->get('sef_advanced_link', 0);

and replace it with this:

Code: Select all

$advanced = $params->get('sef_advanced_link', 1);


2. Look for this section of code in the router.php file and comment it out (lines 313-319):

Code: Select all

if (strpos($segments[0], ':') === false)
{
$vars['view'] = 'article';
$vars['id'] = (int) $segments[0];

return $vars;
}

Comment this section out like this:

Code: Select all

/*
if (strpos($segments[0], ':') === false)
{
$vars['view'] = 'article';
$vars['id'] = (int) $segments[0];

return $vars;
}*/


Tested with v3.4.1 and seems to work just fine.

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Wed Mar 25, 2015 3:46 am

I recently found out about the single word issue. Your fix however works perfectly for single word pages. :D Keep in mind that with CCK's like FlexiContent this breaks the display due to how some CCK's route the page (or something along those lines).

Thanks for the fix. 8)

User avatar
pranabmistry
Joomla! Explorer
Joomla! Explorer
Posts: 339
Joined: Sun Dec 07, 2014 4:51 pm
Location: Dhaka, Bangladesh
Contact:

Re: Remove article id from url for joomla 3.0

Postby pranabmistry » Thu Mar 26, 2015 4:43 pm

on joomla 3.4.1 you need to follow only the "step 2" & you'll be done!!
With Regards
Pranab Mistry

User avatar
zagrox
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Sun Jan 10, 2010 11:08 pm
Location: Tehran
Contact:

just 1 step in new joomla version

Postby zagrox » Tue Apr 14, 2015 8:01 am

Hey Guys
it seems that Joomla fixed the most part of this issue in its new updates.
I checked the router.php file to edit and find out that you only need to change the value of 0 --to--> 1 and no need for the rest of edit code lines.
Go to your Components>Com_content>Router.php > Line 38 > Replace the 0 with 1 and save it. DONE
It works great for me and now no ID in front of category and articles titles in url.

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Tue Apr 14, 2015 8:04 am

@zagrox: While the simple edit version works pretty good, single word article names have issues (as in they fail completely). This is why step 2 as previously mentioned is a good idea to include.

User avatar
pranabmistry
Joomla! Explorer
Joomla! Explorer
Posts: 339
Joined: Sun Dec 07, 2014 4:51 pm
Location: Dhaka, Bangladesh
Contact:

Re: Remove article id from url for joomla 3.0

Postby pranabmistry » Tue Apr 14, 2015 6:24 pm

I have overcome all the issues about URL by using sh404SEF
With Regards
Pranab Mistry

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Tue Apr 14, 2015 7:20 pm

Most of us in this thread are aware that there are SEF extensions that will remove the ids. Aside from costs, the main issue is having a slower performance and compatibility with other extensions. As I've heard before, Joomla will eventually have the id's removed from the core.

BooknookBiz
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Thu Jul 03, 2014 9:43 pm
Location: Phoenix, AZ
Contact:

Re: Remove article id from url for joomla 3.0

Postby BooknookBiz » Fri Apr 17, 2015 11:42 pm

Josh Lewis wrote:Most of us in this thread are aware that there are SEF extensions that will remove the ids. Aside from costs, the main issue is having a slower performance and compatibility with other extensions. As I've heard before, Joomla will eventually have the id's removed from the core.


Can you elaborate on the slower performance? I've just spent a week optimizing the speed on my site, and I'm already extremely annoyed about all the things I can't fix (without extensive $$$ and coders) like where the javascript renders, etc., due to Joomla's structure. I can only get my site up to about an 86/100. What would adding something like 404SEF do, in terms of performance? I don't really care about the expenditure, I'm running a commercial business, and that's just a cost of doing business, but I do care about performance costs.

Thanks in advance.

ETA: I find it pretty mind-boggling that the URL's have to be HACKED in order to eliminate item ids. That seems so fundamentally basic to me, I'm shocked by it. In all the things I assessed, before migrating to Joomla (from EE), it never occurred to me that this would be a problem. I assumed, when Joomla said "sure, we support SEF URL's," that they actually meant it.

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Sat Apr 18, 2015 12:45 am

BooknookBiz wrote:I do care about performance costs.


For starters pretty much any time you install another component into Joomla it slows down the performance. Maybe not by much, but it's there. Some components are more noticeable than others. It's been a long time since I've tested the SEF extensions, so perhaps their performance has gotten better.

Speed isn't the only issue with SEF extensions. Maintaining compatibility and making sure things don't break is another issue. If you have a simple site this probably won't be much of an issue. However if you use many extensions or complicated extensions that get updated, you can find yourself needing the SEF plugin built for the SEF extension needing an upgrade too. So from my point of view I think it's too much hassle. Hacking Joomla's router has been a pretty easily solution and is not causing me any head aches. Keep in mind that this doesn't affect anything beyond articles.

BooknookBiz wrote:I assumed, when Joomla said "sure, we support SEF URL's," that they actually meant it.


For the most part they do. It's easy to create menus that have a structure of "site.com/article" or "site.com/photo/awesome-photos". But the exception is that articles and such have id's in them. As mentioned before I have confidence that they will eventually be removed. However it could be a year before this happens.

User avatar
Kubik-Rubik
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 222
Joined: Wed Aug 25, 2010 1:59 pm
Location: Karlsruhe - Germany
Contact:

Re: Remove article id from url for joomla 3.0

Postby Kubik-Rubik » Tue May 19, 2015 12:05 pm

I've updated the small hack to the latest Joomla! version (3.4.1) on special request:

https://joomla-extensions.kubik-rubik.d ... in-der-url

Download the file and use the correct version. Replace the file router.php in components/com_content.

That's all!
Cheers
Viktor

Kubik-Rubik Joomla! Extensions https://joomla-extensions.kubik-rubik.de

Former member of Joomla! Production Leadership Team, Security Strike Team and Bug Squash Team

craude
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Fri Mar 02, 2007 12:26 am

Re: Remove article id from url for joomla 3.0

Postby craude » Mon May 25, 2015 9:16 pm

@Kubik-Rubik that link to your site is dead. Maybe you should check.

Thanks for your hack.

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 18209
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

Re: Remove article id from url for joomla 3.0

Postby leolam » Tue May 26, 2015 4:02 am

craude wrote:@Kubik-Rubik that link to your site is dead. Maybe you should check.

Thanks for your hack.
Is working and the hack is perfect

Leo 8)
Celebrating 12-Years of Professional Joomla Support Services
- Joomla Professional Support:https://gws-desk.com -
- Joomla Specialized Hosting Solutions:https://gws-host.com -
- Member Joomla Bug Squad & J-CMS Release Team

User avatar
Josh Lewis
Joomla! Guru
Joomla! Guru
Posts: 528
Joined: Wed Jun 11, 2008 11:12 pm
Location: Lynnwood,WA
Contact:

Re: Remove article id from url for joomla 3.0

Postby Josh Lewis » Sun Jun 07, 2015 7:11 am

Good news ladies and gentlemen:

Therefore 3.5 will be shipping with 2 main new features - the work done by Hannes Papenberg on the new Routing system and the code already merged by Nic Dionysopoulos to give email notifications on Joomla Updates.


- Source

According to the dev section, the new routing system will indeed be added to the next major release of Joomla. 8)

lilysmith22
I've been banned!
Posts: 69
Joined: Sat Feb 21, 2015 6:25 am
Location: Augusta
Contact:

Re: Remove article id from url for joomla 3.0

Postby lilysmith22 » Mon Jun 08, 2015 11:32 am

Hey, Please apply availability ajax validation (button 3) to check is there same alias or not. If yes, just add some relevant word to it.

lorenz864
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Mar 04, 2014 1:56 pm

Re: Remove article id from url for joomla 3.0

Postby lorenz864 » Fri Jun 12, 2015 5:03 pm

leolam wrote:
craude wrote:@Kubik-Rubik that link to your site is dead. Maybe you should check.

Thanks for your hack.
Is working and the hack is perfect

Leo 8)


Can you or someone else re-post the Kubik file please? The link is actually broken.

Thanks everybody.

User avatar
rich1
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 190
Joined: Sun Apr 05, 2009 2:17 am
Location: London SE
Contact:

Re: Remove article id from url for joomla 3.0

Postby rich1 » Sun Jun 14, 2015 7:01 pm

@lorenz864
If you go to the home page:
https://joomla-extensions.kubik-rubik.de/
you will see that
Sorry, the complete database on the server crashed and I'm currently abroad in holidays. The website will be available again at latest in the beginning of next week!


Josh Lewis wrote:According to the dev section, the new routing system will indeed be added to the next major release of Joomla. 8)

I for one will not be holding my breath as this has been a request for the last 10 years.
Fortunately Joomla plugins specifically to rid cat id's and article id's in Joomla 1.x and 1.5.x did what the developers would not do, so that was a blessing, without using SEF extensions to deal with this issue.
These plugins were light so had no effect compared to component SEF extensions as described by Josh earlier.
However since 1.5.x I had been using K2 which does strip article and cat ID's.
However recently I started to use the default joomla content again, but am finding the joomla system itself still has many irrational behaviours and again am trying to find something that simply does what I want it to do without hacks.

So we will have to wait and see if we actually get this or not.
In the mean time thanks to all those who posted the hacks, I used (aboenzli):
viewtopic.php?f=712&t=826165&start=60#p3285254

Worked a treat
If you have no 'Coeur de Lion' do not ask why you fail.

lorenz864
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Mar 04, 2014 1:56 pm

Re: Remove article id from url for joomla 3.0

Postby lorenz864 » Mon Jun 15, 2015 8:31 am

Thank you rich1. I've probably got just the wrong time - the site was off. I'll give it a try!


Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 3.x”

Who is online

Users browsing this forum: No registered users and 6 guests