Interspire Product Knowledge Base

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Export to PDF

User Opinions (4 votes)

75% thumbs up 25% thumbs down

How would you rate this answer?



Thank you for rating this answer.

How can I make Article URLs not use folders?

At the moment you'll need to make a bit of an alteration to change the article URLs. This guide will change urls from:

http://www.example.com/articles/23/1/My-Example-Article/Page1.html
to

http://www.example.com/articles-23-1-My-Example-Article-Page1.html

To do this, open up /admin/includes/classes/class.helper.php and find the ArticleLink() function which looks like:

    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;
    }


and can change it to something like this (which changes the /'s to -'s in the URL so it looks like the article.html file is in the base folder)

    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;
    }


Then open up /includes/classes/class.article.php and find:

$this->SetId($this->GetIdFromURL(GetLang('urlArticles')));
and on a new line *before* that, add this line:

$this->Delimiter = '-';
That should now work. If you want to remove 'Page1' from the URL, reedit the ArticleLink function in the class.helper.php file and change:

$suffix = sprintf("%s-%s%d.html", AL_HELPER::_MakeArticleURLSafe($ArticleTitle), AL_HELPER::_MakeArticleURLSafe(GetLang('artPage')), $ArticlePage);
to

$suffix = sprintf("%s.html", AL_HELPER::_MakeArticleURLSafe($ArticleTitle));

Related Articles

No related articles were found.

Attachments

No attachments were found.

Powered by Interspire Knowledge Manager - World's #1 Best Selling FAQ and Knowledge Base Software