I have the below generally working (and have seen plenty of examples showing a single subfolder) but I don't know how to adjust the regex for up to 3 optional subfolders, and to exclude any slashes from the query string value
RewriteRule ^([^/]+)/([^/]+)/(.*)?$ player.php?app=$1&stream=$2&mode=$3&%{QUERY_STRING} [L,QSA]
https://wowza.example.com/App/Stream/Mode/?other=stuff
https://wowza.example.com/App/Stream/Mode
https://wowza.example.com/App/Stream/
https://wowza.example.com/App
https://wowza.example.com
This is my perfect output, showing all of the 3 subfolders with or without values in $_GET
Array
(
[app] => app
[stream] => stream
[mode] =>
[other] => stuff
)
I'm getting either 404, or some variation of this that has the trailing slash.
Array
(
[app] => app
[stream] => stream
[mode] => mode/
[other] => stuff
)
I can see that the trailing ? after the last capture group makes it optional, but don't understand how to make ALL of them optional and to treat the slashes as delimiters, not "values".
Any assistance is appreciated.
With no answers, I'll provide what I got working for the query string, though I'm unable to eliminate the trailing slashes. This rewrite rule accounts for 0-3 folders in the path as well as the provided query string.
RewriteRule ^([^/]+)?/?([^/]+)?/?(.+)?$ player.php?app=$1&stream=$2&mode=$3&%{QUERY_STRING} [L,QSA]
Array
(
[app] =>
[stream] =>
[mode] =>
)
Array
(
[app] => app
[stream] => stream
[mode] => mode/
)