you could take a look on
where I provided a solution for EL I use to get a proper Itemid.
It' not exact what you want but maybe it helps. Possibly you could create (invisible) menu items for each category (e.g. with alias "class") to get nearly the url you like. But I don't remember how good my adaptions work to find the best matching menu item.
The .htaccess I only use to redirect to the home page as fallback. I hadn't taken the time to understand all the possibilities there.
If you find JEM useful and if you use it on your site, please consider a donation to the project.
You are not logged in.
JEM and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.