[#33730] 404 error on login redirection from category list view and unauthorized links

Joomla! Tracker Item [33730](http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33730&start=0)

See #3590

This PR merely integrates the changes described and tested by Matt Thomas in the Joomla! tracker item