http://www.domain.com/folder/file?x=1&y=2
Change to:
http://www.domain.com/folder/file/1/2/
htt
Did you try adding a / before the folder name?
RewriteRule ^folder/(.*)/$ /folder/index.php?x=$1 [L]
RewriteRule ^folder/file/(.*)/(.*)/$ /folder/file.php?x=$1&y=$2 [L]
Try
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder/file/(.*)/(.*)/ /folder/file.php?x=$1&y=$2 [L]
RewriteRule ^folder/(.*)/ /folder/index.php?x=$1 [L]
The order of the rules is important. You should always put the one with the most rules first as your way was getting to the first rule and then stopping because it was always true due to the (.*)
which was capturing the file
.