I want outside assistance regarding .htaccess rewrite rule. Among my page have mixture of following different values which have to be rewrite in various format.

http://mysite.com/test TO http://mysite.com/page.php
http://mysite.com/test/$cat/$id TO http://mysite.com/page.php?cat=$cat&id=$id
http://mysite.com/test/$cat TO http://mysite.com/page.php?cat=$cat
http://mysite.com/test/$cat/&next=13 TO http://mysite.com/page.php?cat=$cat&next=$next 

I presently have following rule that only works best for second and fourth example

RewriteRule ^test/(.+)/(.+)/?$ page.php?cat=$1&id=$2

The very first 3 look pretty straightforward, however i do not understand that which you mean through the 4th one, what is &next? Is the fact that a question string? Would you only worry about this &next if this =13? Here is a stab at speculating what you are searching for (order matters):

# First
RewriteRule ^test$ page.php [L]
# Fourth ??
RewriteRule ^test/([^/]+)/([^=]+)=(.+)$ page.php?cat=$1&$2=$3 [L]
# Second
RewriteRule ^test/([^/]+)/([^=]+)$ page.php?cat=$1&id=$2 [L]
# Third
RewriteRule ^test/(.+)$ page.php?cat=$1 [L]

When the 4th one should be a question string, as with: http://mysite.com/test/foo/?bar=13 you will want to alter the final rule with the addition of a QSA towards the finish:

RewriteRule ^test/(.+)$ page.php?cat=$1 [L,QSA]

If I am misunderstanding still, we are able to range from the rule you've

# First
RewriteRule ^test$ page.php [L]
# Third
RewriteRule ^test/([^/]+)$ page.php?cat=$1 [L] 
# Second and Fourth (your rule)
RewriteRule ^test/(.+)/(.+)/?$ page.php?cat=$1&id=$2 [L]

(you'll need the [L] in the finish otherwise further rules get applied)

These should work, creating separate rules for every situation is simpler. I have needed to have presumptions in your Web addresses.

RewriteRule ^/test$ page.php
RewriteRule ^/test/([^/]+)/([^&/]+)$ page.php?cat=$1&id=$2
RewriteRule ^/test/([^/]+)$ page.php?cat=$1
RewriteRule ^/test/([^/]+)/&next=([^/]+)$ page.php?cat=$1&next=$2