I’m currently trying to rewrite some URLs, and they all follow a basic format.
Here is the current .htaccess rule
RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ index.php?d=$1&n=$2 [QSA]
Sometimes, there are some links, such as
/users/profiles/userid=2
But, the rule is written to rewrite
/users/profiles
as
index.php?d=users&n=profiles
How can I change the rule so that it can optionally accept and add extra parameters?
The rule below will rewrite
users/profiles/userid=2toindex.php?d=users&n=profiles&userid=2. Tested, working fine.If you add the above rule above your existing rule they both will play nicely (I have modified your existing rule a bit):