0
votes

I just turned on SEF Urls and it's working fine when I navigate in my website using the menu.

But when I click on a link generated from an article, then the URL appearing in the URL field is messy. I get:

http://mywebsite.org/fr/publications?id=375

instead of

http://mywebsite.org/fr/publications/comprendre/livres/pinker

In brief the problem is that the SEF url generated is like menuAlias?id=ArticleID instead of being menuAlias/CategoryAlias/ArticleAlias.

I use (as before) the non-SEF URL's for my link:

href="index.php?option=com_content&view=article&id=375&Itemid=265

( Itemid 265 = menu publication and Id 375 = article pinker)

I came across one solution but it's not working:

href="<?php echo JRoute::_('index.php?option=com_content&view=article&id=54&Itemid=20' ); ?>"

Any idea how I have to set up my href I get a SEF (real) Url in my new tabs when I link it from an article ?

Thanks a lot!

1
Can you clarify? You mentioned 2 different types of SEF URL's - which kind would you like to link to in articles/modules? Built in Joomla components utilize the long (non-SEF URL's) so that whether the URL is SEF or not it will always be linked to the appropriate spot (I believe, not sure). Then the SEF conversion happens on the fly when the page is loaded I believe. The best bet would be to turn on SEF URLs in your global configuration - then try linking to an article. That MIGHT provide what you're looking for.Hanny
Thanks Hanny for your help! Sorry for not being more clear. I actually asked two question in one as I thought the answer would be the same... but I have edited now and I only focus and the first question. SEF is one, working fine, I still use non-SEF URL's for my href.MagTun

1 Answers

1
votes

With SEF Urls on, if you want to create a static link to an article from within a module or another article, you shall use the SEF url of the article (of course this will somewhat hard-code the link). A better approach would be to use JCE's links manager, to link to content or a menu item.

Now, the SEF URLs concept in Joomla works like this: If you want to a have a specific url for a single article, you need to create a relative menu item, and give it the name that your SEF url wants to look. (note: it will use the alias).

For many articles that belongs to a category, where you can't or don't want to create menu items for each one, you need to create a Category Menu Item for that category. Then these articles will be using that menu item alias and the article's alias for their SEF URL.

*Notice, that similar questions have been answered again in Stackoverflow.