Joomla has a problem with search-friendly URLs. Path in links is not correctly converted from NON-Friendly links to search-friendly links. The problem only appears when an article is nested in the sub-category.
Steps to reproduce the issue
Settings:
- Global Configuration -> Site -> SEO Settings -> Search Engine Friendly URLs -> YES
- Global Configuration -> Site -> SEO Settings -> Use URL Rewriting -> YES
- Global Configuration -> Site -> SEO Settings -> Add Suffix to URL -> NO
- Global Configuration -> Site -> SEO Settings -> Unicode Aliases -> NO
- Article: Options -> Integration -> URL Routing -> Modern
- Article: Options -> Integration -> Remove ID from URLs -> YES
How to reproduce:
- Create the category "blog".
- Create additional 2 categories. One as the main category ("MainCategory") and the second one as a sub-category ("SubCategory").
- Create a test article (alias of the article: "test-article") into the "SubCategory".
- Create the article (alias of the article: "blog-article") in the blog category. Create a link in the content of the article to the test article to the "SubCategory". Structure the link as follows (index.php?option=com_content&view=article&id=22:test-article&catid=15), use appropriate IDs in link for article and category.
- Add menu item as "Category Blog" to category "Blog".
- Test it; the link in the blog article is broken.
Expected result
https://www.example.com/MainCategory/SubCategory/test-article
Actual result
Link in blog article
https://www.example.com/blog/test-article
System information (as much as possible)
Joomla! version: 3.10.6
Plugins: JCE Editor
Additional comments
I have been able to reproduce that issue on two different Joomla! live websites.
With no itemid in the url you have created Joomla will look to see if that article is already associated with an itemid. If it is then it will use that to structure the url. If it is not then it will use the current itemid to structure the url.