I discovered a few similar questions, however it appears like i want your help, because i am unable to write it by myself.

I would like this: http://domain.com/folder/file.123.ext (should work also without 123)

to become rewritten to /folder/file.min.ext (whether it is available)

or /folder/file.ext (when the minified version does not exist)

It's for my css and js files ... therefore it will load non-minified versions for individuals files that does not have ones.

I presently have this:

RewriteRule ^(css|js)/([a-zA-Z_-]+)\.([0-9]+)\.(css|js)$ /$1/$2.min.$4
RewriteRule ^(css|js)/([a-zA-Z_-]+)\.(css|js)$ /$1/$2.min.$3

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(css|js)/([a-zA-Z_-]+)\.min\.(css|js)$ /$1/$2.$3

it really works fine after i take away the second line ... however i need results also with no number :(

Can't you simply replace the two rules with this particular?

RewriteRule ^(css|js)/([a-zA-Z_-]+)(\.[0-9]+)?\.(css|js)$ /$1/$2.min.$4

Following on from Jon's answer, this will solve the redirect loop problem:

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(css|js)/([a-zA-Z_-]+)(\.[0-9]+)?\.(css|js)$ /$1/$2.min.$4

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(css|js)/([a-zA-Z_-]+)\.min\.(css|js)$ /$1/$2.$3

The very first line may prevent the attached rule from being performed on redirect.

If you discover every other issues or have to tweak this, use RewriteLog and RewriteLogLevel (at level 5) to debug the rule set and discover precisely what mod_rewrite does.