I've got a multilanguage site and I am attempting to rewrite the URL's having a fake directory something similar to this:

http://localhost/theSite/page.php?id=param&cat=param?lang=en,fr,es to http://localhost/theSite/(en|fr|es)/page/param/param

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(fr|en|en)/(.*) $2.php?id=$1&cat=$2&lang=$3 [NL,QSA]

This resolves like a 404 error.

Any assistance will be apreciate.

RewriteRule ^(en|fr|es)/(.*?)/(.*?)/(.*) $2.php?id=$3&cat=$4&lang=$1 [NC,QSA]

I guess you meant NC (no situation), not NL. You known to capture groups that did not exist and repeated $2.

You are second capture will capture everything before the finish from the URL. So it's possible you're doubling on the extension or even the wrong directory.

Even though it should not modify the redirect, you do not have another capture, where is $3?

Review your headers and find out where it really is redirecting to and comment back.