This guide will change your current URL structure from:
www.example.com/articles/{article-id-number}/{article-page-number}/{article-title}/Page{article-page-number}.html
to
www.example.com/articles/{article-title}/{article-id-number}-{article-page-number}.html
Open /admin/includes/classes/class.helper.php
Change the ArticleLink function from this:
function ArticleLink($ArticleId, $ArticleTitle, $ArticlePage = 1) {
if ($GLOBALS['AL_CFG']['useids'] == 1) {
$link = sprintf("%s/%s/%d/%d/", $GLOBALS["AL_CFG"]["siteURL"], GetLang('urlArticles'),
$ArticleId, $ArticlePage);
} else {
$suffix = sprintf("%s/%s%d.html", AL_HELPER::_MakeArticleURLSafe($ArticleTitle), AL_HELPER::_MakeArticleURLSafe(GetLang('artPage')), $ArticlePage);
$link = sprintf("%s/%s/%d/%d/%s", $GLOBALS["AL_CFG"]["siteURL"], GetLang('urlArticles'), $ArticleId, $ArticlePage, $suffix);
}
return $link;
}to this:
function ArticleLink($ArticleId, $ArticleTitle, $ArticlePage = 1) {
if ($GLOBALS['AL_CFG']['useids'] == 1) {
$link = sprintf("%s/%s/%d/%d/", $GLOBALS["AL_CFG"]["siteURL"], GetLang('urlArticles'),
$ArticleId, $ArticlePage);
} else {
$link = sprintf("%s/%s/%s/%d-%s.html", $GLOBALS["AL_CFG"]["siteURL"], GetLang('urlArticles'), AL_HELPER::_MakeArticleURLSafe($ArticleTitle), $ArticleId, $ArticlePage);
}
return $link;
}Now open up /includes/classes/class.article.php and find:
$this->_page = $this->Segments[2];
and remove it, or comment it out like:
// $this->_page = $this->Segments[2];
Then finally open up /includes/classes/class.content.php and find the GetIdFromURL() function and change it from:
function GetIdFromURL($SearchStr) {
$this->LoadURISegments($SearchStr);
if(isset($this->Segments[1])){
$id = $this->Segments[1];
}else{
$id = 0;
}
if(isset($this->Segments[2])){
$pagenum = $this->Segments[2];
}else{
$pagenum = 0;
}
if (!is_numeric($id)) {
$id = 0;
}
if (isset($_REQUEST["ArticleId"])) {
$id = (int)$_REQUEST["ArticleId"];
}elseif (isset($_REQUEST["ContentId"])) {
$id = (int)$_REQUEST["ContentId"];
}elseif (isset($_REQUEST["BlogId"])){
$id = $_REQUEST["BlogId"];
}elseif (isset($_REQUEST["NewsId"])) {
$id = $_REQUEST["NewsId"];
}
return $id;
}and change it to:
function GetIdFromURL($SearchStr) {
$this->LoadURISegments($SearchStr);
if($SearchStr == GetLang('urlArticles')){
if(isset($this->Segments[2])){
$id_long = $this->Segments[2];
$id_long = str_replace(".html", "", $id_long);
$idBits = explode("-",$id_long);
$id = $idBits[0];
$this->_page = $idBits[1];
}else{
$pagenum = $id = 0;
}
}else{
if(isset($this->Segments[1])){
$id = $this->Segments[1];
}else{
$id = 0;
}
}
if (!is_numeric($id)) {
$id = 0;
}
if (isset($_REQUEST["ArticleId"])) {
$id = (int)$_REQUEST["ArticleId"];
}elseif (isset($_REQUEST["ContentId"])) {
$id = (int)$_REQUEST["ContentId"];
}elseif (isset($_REQUEST["BlogId"])){
$id = $_REQUEST["BlogId"];
}elseif (isset($_REQUEST["NewsId"])) {
$id = $_REQUEST["NewsId"];
}
return $id;
}