Reputation: 221
I currently have this line in my .htaccess file:
RewriteRule ^(20\d\d)/([A-Za-z0-9-]+)/$ /test/?type=post&year=$1&title=$2 [L]
It allows a URL like this:
/test/?type=post&year=2014&title=hello
to be accessed like this:
/test/2014/hello/
However, sometimes I have even another GET variable on the rewritten URL:
/test/2014/hello/?page=2
However, the get variable page
isn't read by the PHP file on the page. So in other words, how can I alter my .htaccess file to allow the other get variables (added onto the rewritten URL) to be used and read by the PHP file?
Upvotes: 1
Views: 2210
Reputation: 20554
You need to add a QSA flag to your rewrite rule, so that the brackets look like this:
[L,QSA]
This tells apache to append any existing query string to the new query string in the target (mode=allBrands).
more Info there: https://cwiki.apache.org/confluence/display/HTTPD/RewriteFlags+QSA
Upvotes: 7