Custom URL based on Categories
I wouldn't normally set up a site like this — but given your setup, the following should work.


In the category settings, make sure that your category has 'Entries in this section have their own URLs' checked.
Set your category url format to:


top-level: {slug}
nested categories: {parent.uri}/{slug}

Set your article entry url format in the channel settings to {category.last.uri}/{slug} (where 'category' is the handle of your category field.)


Note the use of last. Categories will be returned as an Element Criteria Model which behaves much like an array (even if there is only one defined). The use of last will return the last category element, which should be the uri pattern that you're looking for.

Of course, if you have other routes in the CMS you will have to be careful about routing conflicts.

As a side note, you might want to consider using a 'structure' instead of 'categories'. I commonly use a single structure that represents all of the top level pages in a site, using Entry Types to distinguish the various field requirements and page layouts. You can then include the appropriate template layout automatically based on 'entry.type'. Likewise, you can use this structure to easily generate your site nav, and be fairly confident you won't run into any routing conflicts. The only reason I mention this is that you seem to already be heading in this direction with your current setup.

Edit: I might also add that you will want to make your category field required, otherwise there will be no route to the article in question.