With "localhost/apply/import?code=abc123"
, the first rule is matched (you can check it by removing second rewrite code)
If you want to trigger second rewrite rule, you should try something like localhost/apply/import/abc123
and this will be the result:
Array ( [action] => import [code] => abc123)
UPDATE: I think this can solve your problem:
You can use [QSA]
to get extra Query String parameters, in your first rewrite rule:
RewriteRule ^apply/import?$ index.php?action=import [QSA]
Then going to localhost/apply/import?code=abc123
will output this:
Array ( [action] => import [code] => abc123)
You can read more about RewiteRule Flags. Here is the explanation:
When the replacement URI contains a query string, the default behavior
of RewriteRule is to discard the existing query string, and replace it
with the newly generated one. Using the [QSA] flag causes the query
strings to be combined.