Need Help with .htaccess file url rewriting

hello

i need some help with htaccess url rewrite

i want this
when user open the url

www.mywebsite.com/12345

then he get redirected to the page

www.mywebsite.com/index.php?id=12345

and when user opens

www.mywebsite.com/anyfolder/12345

then he get redirected to

www.mywebsite.com/anyfolder/index.php?id=12345



plz help me about this
what code i should use in htaccess file to get this thing working


Need Help with .htaccess file url rewriting
***

GURU4SEO

***