Joomla URLs: An article doesn't have a pretty

2019-02-24 21:13发布

问题:

I'm new to Joomla (1.5), and I'm trying to clarify something about the way Joomla handles URLs.

I've activated what they call "Search Engine Friendly URLs". But it appears that a page (or an "Article" only gets such a URL once I link to it from a menu.

Are pretty (parameter-less) URLs really only assigned to pages once I link to them from a menu?

I know I can assign Aliases to articles, but they don't seem to do anything. An article's URL seems to be defined by the alias of a menu item that links to it.

Is this correct, and if so, how do I link to pages without listing them in a menu (e.g. from within another page).

Thanks

Hannes

回答1:

Update: This really seems to be the case. Why on earth anyone would design a CMS in such a way is beyond me, but my guess is that it's historic (there used to be only parameter-style URLs, and then pretty URLs were slapped on at some point).

This would normally be a dealbreaker for me. A page shouldn't have a bunch of different URLs.

But I found one way around this. It's an extension called sh404SEF (http://extensions.joomla.org/extensions/2380/details). It rewrites all URLs on the site and is actually pretty smart about it.



回答2:

Hannes. I'm unable to reproduce your SEF URL problem. Here are the steps I took in an effort to recreate your problem using Joomla Version 1.5.12:

I first enabled SEF URLs per this article.

  • Admin > Site > Global Configuration > Site > SEO Settings > Yes to the three options.

I then created test content without adding it to a menu:

  1. Admin > Content > Section Manager > New > "Test Section"
  2. Admin > Content > Category Manager > New > "Test Category"
  3. Admin > Content > Article Manager > New > "Test Article" and assigned it to "Test Section / Test Category"

Now I have a Joomla article that is not assigned to a Menu.

I then went to another article in my site and created a link to my Article entitled "Test Article."

  1. Admin > Content > Article Manager > Edit > "Source Article"
  2. Highlight/select a word > Insert/Edit Link > Link Browser > Content (NOT Menu) > Test Section > Test Category > Test Article > Insert

Note that I was able to link to this article by selecting it as Content. Had I assigned it to a menu, that also would have been an option, but it is not a requirement.

Next I go to the front-end to determine if the "Test Article" has a SEF URL or not. In my case, even though "Test Article" was not assigned to a Joomla Menu, it did have a SEF URL when I followed this method.

My SEF URL looked something like this (using example.com as a "fake" domain):

  • somedomain/test-section/99-test-category/217-test-article.html

I started building a new Joomla site in May 2009 using 1.5 and so far have not found a need for the sh404SEF extension, although I have observed it has positive reviews.



回答3:

I know this is an old question, but in joomla 3 you would do:

http://example.com/index.php/category-alias/article_id-article_alias

So if the id of you article is 3 and alias is articlealias in category alias, url should be:

http://example.com/index.php/alias/3-articlealias

Test it, it works.