I am working on a rewrite base file - and need to add an extra parameter
currently its reading like this
RewriteEngine on
RewriteBase /img/pins/
RewriteRule ^(.*)$ pins.php?n=$1 [QSA,L]
and that is fine as it comes out /img/pins/1 n=1
but I need to write the file to accomodate a new flag
so /img/pins/1/check
n=1 f=check
RewriteEngine on
RewriteBase /img/pins/
RewriteRule ^(.*)$ pins.php?n=$1&f=$2 [QSA,L]
^ but this current version indicates n=1/check f=
If i undestand correctly. You need two group. If you want it will work with empty path or 1 and 2 groups, don't remove question sign after slash
RewriteEngine on
RewriteBase /img/pins/
RewriteRule ^([^/]*)/?(.*)$ pins.php?n=$1&f=$2 [QSA,L]
RewriteRule ^(.*)\/(.*)$ pins.php?n=$1&f=$2 [QSA,L]
However if you know the first parameter is a number and the second one is alphanumeric I'd go for
RewriteRule ^([0-9]+)\/([0-9a-z]+)$ pins.php?n=$1&f=$2 [QSA,L]
That would help a lot with potential parsing and injection issues