I have the following rules in my file .htaccess
:
RewriteRule ^first-login/([a-zA-Z0-9]+)$ ./first-login.php?userKey=$1&step=1
RewriteRule ^first-login/([a-zA-Z0-9]+)?([0-9]+)$ ./first-login.php?userKey=$1&step=2
The first one works, I use the URL http://localhost/first-login/Xmi5drXyH9ngm4
and it fills the $_GET["userKey"] e $_GET["step"]
variables with the correct values.
This page is a wizard with a few steps to the first user account configuration, at the end of each step, I redirect the user to the same page just changing the value of step
, so I submit the content targeted. URL used: http://localhost/first-login/Xmi5drXyH9ngm4?2
.
The problem: even with ?2
at the end, I'm being redirected according to the first rule, so my variable $_GET["step"]
is always getting the value 1. What wrong in these regular expressions? For now I'm doing the process of hiding / displaying content with jQuery.