Actually the thing is that i'm having a sub domain (example.domain.com) which is redirected from other domain of a folder (www.domain/folder) . but need the rewrite rule for my sub domain which shows the url links for the main domain ie., www.domain/folder/path i need to get as example.domain.com/path. Instead of getting the main domain path i need to expose the URL with sub domain path.
As far as I can tell, there are two ways to do what you are wanting. Both of them require significant extra overhead. Both are also likely to require example.domain.com to lie about who it is.
I wouldn't recommend either if you can avoid it, but.
Method #1
Set up a transparent proxy on www.domain.com/folder to show the contents from example.domain.com. If I recall correctly, this can be done with mod_proxy, but I don't remember how specifically.
Method #2
Set up a rewrite rule on www.domain.com/folder to redirect to example.domain.com. Then set up example.domain.com to either lie about who and where it is, or fix all links in pages on example.domain.com to explicitly go to http://www.domain.com/folder.
In the root .htaccess file on www.domain.com: (to redirect to the subdomain)
RewriteRule ^folder/(.*) http://example.domain.com/$1 [R, L]