I am retooling my URL to be part Pretty URL and part Query String to make it more SEO friendly.
In the past, my URL looked like this...
And my mod_rewrite looked like this...
RewriteRule ^([^/]+)/([^/]+)/$ articles/index-subsection.php?section=$1&subsection=$2 [L]
If someone decides to navigate to a different page, or perform a sort, then the URL above will change to something like this...
If I leave my mod_rewrite as it used to be, then I can have this new URL, but the $_GET variables appear to be blank.
How should I adapt my mod_rewrite so it works for either type of URL??
By changing [L] to [L,QSA]
"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."
You beat me to the punch!
I tried this and it seems to be working...
RewriteRule ^([^/]+)/([^/]+)/$ articles/index-subsection.php?section=$1&subsection=$2 [L,QSA]