4

In sh404sef url manager I noticed that a sef url had been created for a page I had no menu item for. The non-sef url was index.php?option=com_content&id=27&lang=en&view=category

I've since created new categories and found corresponding non-sef urls, so it seems Joomla is automatically creating these links.

Anyway just to be sure,

  • does Joomla automatically create a non-sef url when a category is created?
  • If yes, (this might seem like blasphemy, but ) is there a way to prevent this?

MISC The reason I'd want to prevent the non-sef url is because in the past I've sometimes created articles for use as category pages. Again probably blasphemy because I should probably be using a layout override??

5

It is best to not think of Joomla as "creating these links" and instead recognizing that there are a variety of urls that Joomla can understand and load a page from.

The non-sef url represents the variables that any SEF url gets translated into. The only piece that is missing from your url would be an Itemid which corresponds to the menu item id.

I haven't actually used any solution to try to prevent these types of urls from working. Your best bet is to actually check for the url early in a page load (probably using a system plugin), pass the url through JRoute (which will convert it to a search engine friendly url if possible and enabled), and then redirect to that url if the urls don't match.

This should not be done for POSTs (since the post data would be lost in the redirect most likely) and may lead to some weird issues possibly (not sure that JRoute is always super precise, so you may get multiple answers for similar urls).

Finally, there may already be plugins like this one http://extensions.joomla.org/profile/extension/site-management/seo-a-metadata/canonical-url that do something similar. (Never tried this one, just googled a touch.)

  • Thanks David. It's not a big problem, it was more of a shock than anything. I had always thought that I had to link the category to a menu item before it generated any sort of url. Anyway I'll use sh404sef for the canonicals and I'll link directly to a category and use an alternative layout rather than use an article disguised as a category. – TryHarder Feb 2 '15 at 4:36
  • Nope. Likewise, even if you don't have a menu item to register, you can still get to the user registration form if you type the standard url for it. (Which is why we now have an option in the user manager to disable user registration, since you can't really block the url...) – David Fritsch Feb 2 '15 at 15:58

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.