Remove ID from URL

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

Moderator: General Support Moderators

Locked
Nadeem73
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Nov 14, 2011 10:19 am

Remove ID from URL

Post by Nadeem73 » Mon Nov 14, 2011 10:25 am

Hi

I i was wondering if there is a way to remove the article ID from the URL produced by the in built SEF of joomla or at least tag it to the end.

I find it being at the beginning just does not work to well from me :)

Is this possible

Thanks

badstue
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Jan 15, 2009 9:50 am

Re: Remove ID from URL

Post by badstue » Wed Nov 16, 2011 11:06 am

Have you found a solution ? I'm looking for the exact same thing..

GWealth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Tue Dec 20, 2011 2:31 am
Contact:

Re: Remove ID from URL

Post by GWealth » Tue May 29, 2012 5:59 am

I had exactly the same problem. Did all I could to remove the ID from my website's url's. I tried downloading plugins, but only that most of them didn't work and were to complicated. Besides, you don't want to slow your website down with unnecessary plugins if you don't really need to.

So many other I noticed liked to recommend "just point a menu to the article, and that will remove the ID Number." But this is really unpractical. I don't want to clutter my website with "Menu Items."

So this is how I fixed mine:

The solution is that you will need to open components\com_content\router.php in an editor and make a few small changes (be sure to backup router.php):

in function ContentBuildRoute(&$query) go to line 27 and change "0" to "1"

27:

Code: Select all

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

Code: Select all

$advanced    = $params->get('sef_advanced_link', 1);
in function ContentParseRoute($segments) go to line 208 and change "0" to "1"

208:

Code: Select all

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

Code: Select all

$advanced    = $params->get('sef_advanced_link', 1);
Then you will need to comment out lines 228-232
228
229
230
231
232

Code: Select all

if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}
so it would be changed to

Code: Select all

/*
if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}*/
That's it! I tested this on my Joomla 2.5 test site and finally got rid of those annoying IDs that kept showing in my site's url locations.

The old urls with the IDs still work if you link to them (which is good to avoid dead links, but you still want to have everything point to non-ID'd urls), so any manually linked pages that you've typed out in your website, you will need to edit and remove those ID's in those links you put in. For example:
You would change any links like this
http://www.example.com/tools/28-article-page
to
http://www.example.com/tools/article-page

The later link would work and replace the first link.

If you're not sure and can't decide whether you want to make any changes, you can have a look at the url's on my website http://www.graspthewealth.com and see for yourself as to if there are article IDs showing in the urls. Most Articles showed an ID, especially the calculators. Finally this solution is what worked for me.

This information I found from:
http://developernote.com/2012/05/how-to ... oomla-2-5/

preynt
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Nov 24, 2011 3:22 am
Contact:

Re: Remove ID from URL

Post by preynt » Sat Jun 02, 2012 9:45 am

GWealth wrote:I had exactly the same problem. Did all I could to remove the ID from my website's url's. I tried downloading plugins, but only that most of them didn't work and were to complicated. Besides, you don't want to slow your website down with unnecessary plugins if you don't really need to.

So many other I noticed liked to recommend "just point a menu to the article, and that will remove the ID Number." But this is really unpractical. I don't want to clutter my website with "Menu Items."

So this is how I fixed mine:

The solution is that you will need to open components\com_content\router.php in an editor and make a few small changes (be sure to backup router.php):

in function ContentBuildRoute(&$query) go to line 27 and change "0" to "1"

27:

Code: Select all

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

Code: Select all

$advanced    = $params->get('sef_advanced_link', 1);
in function ContentParseRoute($segments) go to line 208 and change "0" to "1"

208:

Code: Select all

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

Code: Select all

$advanced    = $params->get('sef_advanced_link', 1);
Then you will need to comment out lines 228-232
228
229
230
231
232

Code: Select all

if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}
so it would be changed to

Code: Select all

/*
if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}*/
That's it! I tested this on my Joomla 2.5 test site and finally got rid of those annoying IDs that kept showing in my site's url locations.

The old urls with the IDs still work if you link to them (which is good to avoid dead links, but you still want to have everything point to non-ID'd urls), so any manually linked pages that you've typed out in your website, you will need to edit and remove those ID's in those links you put in. For example:
You would change any links like this
http://www.example.com/tools/28-article-page
to
http://www.example.com/tools/article-page

The later link would work and replace the first link.

If you're not sure and can't decide whether you want to make any changes, you can have a look at the url's on my website http://www.graspthewealth.com and see for yourself as to if there are article IDs showing in the urls. Most Articles showed an ID, especially the calculators. Finally this solution is what worked for me.

This information I found from:
http://developernote.com/2012/05/how-to ... oomla-2-5/
Thanks a lot, that's exactly what i need
Please read forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65

GWealth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Tue Dec 20, 2011 2:31 am
Contact:

Re: Remove ID from URL

Post by GWealth » Wed Jun 20, 2012 5:21 am

preynt wrote:Thanks a lot, that's exactly what i need
You're welcome, preynt!

Since I've done these changes, I've noticed an increase in my traffic from search engines!

The SEF (Search Engine Friendly) section in Joomla SEO Settings under the Global Configuration isn't quite so SEF, but applying those instructions I posted showing how I was able to remove those annoying ID's from the url as really made a huge difference! 8)

Adrian98
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Wed Feb 08, 2012 8:54 am
Contact:

Re: Remove ID from URL

Post by Adrian98 » Thu Jun 21, 2012 11:56 am

Wow, All I can say that I was just about to ask the same question just now that i was going to ask the same problem's solution but now I have got the solution! Thanks folks!
Please read the Forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65

GWealth
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Tue Dec 20, 2011 2:31 am
Contact:

Re: Remove ID from URL

Post by GWealth » Fri Jun 22, 2012 11:31 pm

One note though... I did notice that once I upgraded from my Joomla to the latest version, these changes disappeared due to the update.

So all I did after I upgraded Joomla, was re-apply all these changes again, after that the site was running nicely without those annoying IDs again.

I'd recommend save these instructions for future reference, so that way every time you do an upgrade, if needed, you can easily apply these changes again. 8)

tkfnetwork
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon May 13, 2013 3:43 pm

Re: Remove ID from URL

Post by tkfnetwork » Mon May 13, 2013 3:49 pm

Just an update, you can use the Joomla 3.0.4 router.php in Joomla 3.1 to continue using the router.php hack (which doesn't work in 3.1's router.php)

User avatar
Abcplumb
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Sun Jan 08, 2012 9:09 am
Contact:

Re: Remove ID from URL

Post by Abcplumb » Thu Jun 06, 2013 8:13 pm

GWealth wrote:I had exactly the same problem. Did all I could to remove the ID from my website's url's. I tried downloading plugins, but only that most of them didn't work and were to complicated. Besides, you don't want to slow your website down with unnecessary plugins if you don't really need to.

So many other I noticed liked to recommend "just point a menu to the article, and that will remove the ID Number." But this is really unpractical. I don't want to clutter my website with "Menu Items."

So this is how I fixed mine:

The solution is that you will need to open components\com_content\router.php in an editor and make a few small changes (be sure to backup router.php):

in function ContentBuildRoute(&$query) go to line 27 and change "0" to "1"

27:

Code: Select all

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

Code: Select all

$advanced    = $params->get('sef_advanced_link', 1);
in function ContentParseRoute($segments) go to line 208 and change "0" to "1"

208:

Code: Select all

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

Code: Select all

$advanced    = $params->get('sef_advanced_link', 1);
Then you will need to comment out lines 228-232
228
229
230
231
232

Code: Select all

if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}
so it would be changed to

Code: Select all

/*
if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}*/
That's it! I tested this on my Joomla 2.5 test site and finally got rid of those annoying IDs that kept showing in my site's url locations.

The old urls with the IDs still work if you link to them (which is good to avoid dead links, but you still want to have everything point to non-ID'd urls), so any manually linked pages that you've typed out in your website, you will need to edit and remove those ID's in those links you put in. For example:
You would change any links like this
http://www.example.com/tools/28-article-page
to
http://www.example.com/tools/article-page

The later link would work and replace the first link.

If you're not sure and can't decide whether you want to make any changes, you can have a look at the url's on my website http://www.graspthewealth.com and see for yourself as to if there are article IDs showing in the urls. Most Articles showed an ID, especially the calculators. Finally this solution is what worked for me.

This information I found from:
http://developernote.com/2012/05/how-to ... oomla-2-5/
Does anyone know if this will work for joomla 1.5.26??
By trade a gas engineer but by passion a graphic designer.


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 1.5”