对每个参数使用相同的重写规则

I have a file named dev.php which has 5 parameters. It's a step by step procedure where the same file will be used and the result will be based on each of the parameters. Let me be more clear with an example.

http://www.example.com/dev.php?a=1&b=10&c=100&d=1000&e=10000

First, the user has to choose an option based on which they will be redirected to the next page.

I am using this rule:

RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /dev.php?a=$1&b=$2&c=$3&d=$4&e=$5 [L]

It works fine when all the five parameters are present in the query, but throws a 404 error when there are 1-4 parameters. I want the Rewrite Rule to make this work even if 1 parameter is passed.

Sorry for the weird heading. I don't have any idea in what way I should ask the question.

If the RewriteRule's template doesn't exactly match the SEO-form URI that was input, there will be no rewrite, and the server will attempt to load /1/10/100/1000 which doesn't exist (and thus the 404). One way to fix it is to have 5 RewriteRules, one for one parameter given, one for two, etc. Only one of them should match. Check that the final result /dev.php... doesn't trip any of the rewrites -- you might put the single match first, then the two parameters, etc. Also consider making an optional / on the last parameter, since users will often type it in.