0

I use joomla 3.4.3.

some article posted about how to remove article id, but how can I change article id from example.com/1-test to example.com/1/test ?

Thank You...

3
1

One way to accomplish this is to write a custom build and parse rule in a system plugin. This hooking into the content router that converts urls from /index.php?option=com_content&view=article&id=2 to /2-article-alias and back.

See https://github.com/blackbricksoftware/multicampus for an example. A skeleton of what is needed is below.

class PlgSystemChangearticleurls extends JPlugin {

    public function onAfterInitialise() {
        $app = JFactory::getApplication(); 
        $doc = JFactory::getDocument();

        if ($app->isAdmin()) return;

        $router = $app->getRouter();
        $router->attachBuildRule(array($this, 'buildRule'));
        $router->attachParseRule(array($this, 'parseRule'));
    }

    public function buildRule(&$router, &$uri) {
        /* adapt display of urls */
    }

    public function parseRule(&$router, &$uri) {
        /* adapt routing of urls to corrent item */
    }
}
0

The URL of a page is determined by the menu structure.

Just create a menu item of type Single Article and link to your article. The alias of that menu item will be used in the URL structure.

Note: Joomla 3.4.3 has a security issue. Update your website asap to Joomla 3.4.5, see https://www.joomla.org/announcements/release-news/5634-joomla-3-4-5-released.html

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.