I need to get the query string into a .php script.
The context: .htaccess includes as follows:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([A-Za-z0-9_-]+)\ HTTP/
RewriteRule ^([A-Za-z0-9_-]+)$ /cms/$1.php [L]
or
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /folder/([A-Za-z0-9_-]+)\ HTTP/
RewriteRule ^([A-Za-z0-9_-]+)$ /folder/cms/$1.php [L]
So, the URL is example.com/page (or example.com/folder/page) and the resource is at example.com/cms/page.php (or example.com/folder/cms/page.php)
Adding parameters to the URL throws up an error so my .htaccess also includes, before the above examples:
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^search(.*)$ /cms/search.php?%1
or
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^search(.*)$ /folder/cms/search.php?%1
(search.php is the file that performs a search)
It seems to work, but I've arrived here by reading up plus some trial and error. There seems to be several way of doing this (from reading up) so I am wondering if my rule is efficient and whether I need some sort of flag at the end, eg: [NC,L,QSA].