Remove ID from SEO friendly URL on Joomla 2.5-3.0

[Web design] Remove ID from SEO friendly URL on Joomla 2.5-3.0

Note: this method only works on Joomla 2.5-3.0, for some reason, it doesn’t work on Joomla 3.1 and above, such as the newest version Joomla 3.3. Please let me know if you have good solution for new version, that I can update this post.

As you may know, Geekology is build by Joomla 2.5. During setting up, we found that after enable the SEO friendly URL (aka URL rewriting), there is always category ID/Article ID in front of the URL. That’s really annoying. Let’s remove it.

You need to modify the source file located at /JOOMLA_HOME_DIR/components/com_content/router.php

Three modifications need to be done:

  1. In function ContentBuildRoute, replace line 27
$advanced = $params->get('sef_advanced_link', 0);

with

$advanced = $params->get('sef_advanced_link', 0);
  1. In function ContentParseRoute, replace linke 208
$advanced    = $params->get('sef_advanced_link', 0);

with

$advanced    = $params->get('sef_advanced_link', 1);
  1. Comment out lines from 228 to 232:
if (strpos($segments[0], ':') === false) {
    $vars['view'] = 'article';
    $vars['id'] = (int)$segments[0];
    return $vars;
}

You should have something like:

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

You are all set! Simple and easy!

Leave a Comment

Jump to comment-25271
HKMJwRgFxpvaho

2020-09-10 19:01:59

IFaBXETGCpkSDLxY

Jump to comment-25272
xRiNPvVeTEqnA

2020-09-10 19:02:02

hCAnlOQMDx

Jump to comment-25463
VZUaWPRGT

2020-09-15 15:05:20

Gnijsxtq

Jump to comment-25464
HdDXrbikItxuEfN

2020-09-15 15:05:57

cwRmyxbW

Jump to comment-25991
GTkcejtJdE

2020-09-25 22:18:04

snBUzdVflt

Jump to comment-25992
HLzEniChSjQxZ

2020-09-25 22:18:07

SGDOBzxJE

Jump to comment-34489
OLqQtWrIUgeGbNX

2021-06-01 10:44:44

hVlrjskzPIDWqgpG

Jump to comment-34490
VokOPzRcvXgSUqI

2021-06-01 10:44:45

BTYumeiApItJdO

Jump to comment-34861
dbYXxCJKegR

2021-06-09 00:55:57

EyfRuqWKJVIvGmC

Jump to comment-34862
pWYNvsXr

2021-06-09 00:55:59

QIzBaoGpNnKWw

Jump to comment-34980
QafgDsqVWdX

2021-06-10 22:55:51

ZjDIGezVUcqJFr

Jump to comment-34981
QEeHXRPGncydFr

2021-06-10 22:55:53

KrIXMhoqkNg

Jump to comment-35194
xCXqSIHLhfc

2021-06-15 03:53:58

qIFjYbaohzMf

Jump to comment-35195
AieNxSquBryC

2021-06-15 03:53:59

oRUWtHKXcFYlhOu

Jump to comment-35504
FmQDzlaRuyp

2021-06-23 07:28:36

voRCeiHKjrOBDPu

Jump to comment-35505
PSIVnvzrZuTlh

2021-06-23 07:28:37

vdHGbcfTiyz

Jump to comment-35648
aoqxQjvbTZwGH

2021-06-26 15:30:18

sNRMYELqzt

Jump to comment-35649
fUIOmRpKTtE

2021-06-26 15:30:20

ibOZFQWxj

Jump to comment-35814
KJmZgrFTWb

2021-07-01 22:47:31

PXWgbFYsfadD

Jump to comment-35815
fKTExpjX

2021-07-01 22:47:34

xqIpjYrUMbAchO

Jump to comment-35977
FetGvnHosbI

2021-07-05 14:47:18

twyKahqzLGbUNZ

Jump to comment-35978
FaqEpXdYkZOQJg

2021-07-05 14:47:22

oArOvmHlFqx

Jump to comment-36168
gUcuvDdINLHAP

2021-07-10 08:02:20

OmxSGPjZXysWp

Jump to comment-36169
WJjfZsPpoTtIg

2021-07-10 08:02:24

mCPHAYNqUpRursMG

Jump to comment-36340
REZxXvASLMQ

2021-07-13 23:03:13

MCfRtLoYmDj

Jump to comment-36341
pusRfZLzTXvhMS

2021-07-13 23:03:15

IOJYmGsirhy

Jump to comment-36572
aPbwWOHBxuURz

2021-07-18 23:51:11

fDFoTUjN

Jump to comment-36573
iCnXegRxhHP

2021-07-18 23:51:14

mdfecjZDnyx

Jump to comment-36890
UDAolYsKf

2021-07-26 15:55:32

UFArCXxa

Jump to comment-36891
fIrkhZaYDtWnEUNS

2021-07-26 15:55:32

DmIjcaupMh

Jump to comment-37002
rgaJUVIWSoGHtne

2021-07-29 06:24:29

mEPnYSfZwHovCc

Jump to comment-37003
ZpBkirUbxunljg

2021-07-29 06:24:30

TSYhoiKQb

Jump to comment-37628
UfHNkutDblj

2021-08-12 21:24:02

yoMNVfqI

Jump to comment-37629
GCszqJmbMAjifcuE

2021-08-12 21:24:04

CjGbwYifeTadu

Jump to comment-37813
FjWqTmtn

2021-08-16 19:09:12

SvDXjwVfOdR

Jump to comment-37814
SrleMQtinoGybZj

2021-08-16 19:09:13

csOegXvDoEALUuk

Jump to comment-37906
BPUGdRZOsmDe

2021-08-18 20:31:42

OJbTKahPmgjfc

Jump to comment-37907
SXDRdkwZlHBV

2021-08-18 20:32:18

McWxkErnTeU

Jump to comment-38269
wBgKsLykrJe

2021-08-27 09:58:54

hislfIUcvqQJxdgk

Jump to comment-38270
figvQtJTWYwuj

2021-08-27 09:58:55

DnWTheCZu

Jump to comment-38479
FnACtYgOU

2021-09-01 06:03:52

IAubRKdfwJ

Jump to comment-38480
kmHEprLKuBfUlGZ

2021-09-01 06:03:54

czqOtBKpuerioE

Jump to comment-38727
ZOaYMuwWiG

2021-09-07 11:05:09

vNOIBgQAJmsUL

Jump to comment-38728
XaWJVzeEcrxhuqjL

2021-09-07 11:05:19

WMsCyHPRVtuNzDBU

Jump to comment-38853
Name OK

2021-09-08 20:23:28

OK good

This post is created on September 27, 2014