0

I would like to remove the article ID from Joomla SEF URLs. For that I found a mod which works only if the SEF URLs containing at least one character other that numbers. But I need numbers only SEF URLs for my articles.

For example: http://something.com/category/1234567890 But if I do this joomla returns 404 article not found error If I put any other char in like this http://something.com/category/1234567890-1 than it works.

How can I make it work with numbers only?

Oh and the mod which I tried is simply changing the 0 to 1 in the com_article/router.php in this code $advanced = $params->get('sef_advanced_link', 0);

Laci K
  • 585
  • 2
  • 8
  • 24
  • That's a very strange url, how are you creating it? Is the number a string or is it the key for the article? I think it's probably looking in the database for an article or more likely maybe a category with that key but just a guess. – Elin Jun 25 '15 at 01:41
  • I get that number from an automatically created excel sheet from a printig house and those articles are connected to printed materials and QR codes, but sadly I was left out from the process and now I have to deal with this. Nobody asked me if it's possible or not. – Laci K Jun 25 '15 at 13:07
  • So what I mean is ... are you using the number in the alias field for the content item? Because that is what controls the url. It's very bizarre to have category like that. Are you getting that from something you typed or is Joomla generating it. – Elin Jun 25 '15 at 19:01
  • The category name is just an example the real name of the category would translate to "wallets" in English, and the numbers I use as the alias – Laci K Jun 27 '15 at 00:06
  • Okay so you would have a menu link to wallets? I had not trouble at all using an alias with all numbers. No you don't need to turn on the "advanced" setting if you make the menu link. – Elin Jun 27 '15 at 12:11
  • Yes I have a menu link to wallets. Its a category list type menu item in my main menu. There is no trouble with number alias until you modify the router.php to disable article id from SEF urls. Oh and I didn't turned on "advanced" settings. I tried this mod on my localhost whit the latest Joomla and latest php 5.6.x and mysql and IIS and it has the same affect it runs into 404 article not found error. – Laci K Jun 27 '15 at 13:19
  • Can you please post the code you modified in the router? – Elin Jun 28 '15 at 02:43

1 Answers1

0

Go to file components\com_content\router.php

and comment the folowing code :

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

            return $vars;
        }*/

Hope that work for you