Url rewrite problem

I do not quite understand your rewrite rules, but maybe this helps: