Welcome to WebmasterWorld Guest from 18.104.22.168
Since there are thousands of webmasters and many of them seek free code we've adopted a policy that's in the Charter [webmasterworld.com] for this forum. Specifically, I'd like to direct your attention to this section:
This is not the Apache mod_rewrite support desk! PLEASE do your homework before posting a mod_rewrite question. We prefer to limit discussions to mod_rewrite aspects not already covered. For beginners, an introduction to Apache redirects and mod_rewrite is available here [webmasterworld.com].
I can't write it myself, I would take ages to test all possible codes for me.I urge you to read this Introduction post [webmasterworld.com], then study and at least learn some basics. Then post your own solution. Some of our regular members will be happy to help you debug it and you will be able to maintain it and enhance it in the future.
It seems that English may not be your primary language which could make learning difficult for you. If so, posting an ad in the Commercial Exchange forum and hiring someone to write your code for you may be an attractive option.
Again, welcome aboard!