I am having trouble using .htaccess to internally rewrite (that is, use the requested URL to form an internal request to then provide that to the client, who still only sees the original requested URL) a URL where only one parameter is prettified, and the rest of the request parameters are still appended. Other posts on stack either concern just one relevant parameter, or wish to redirect every parameter.
That is,
- https://new.mysite.com/overhoringen/open/7 should internally request https://new.mysite.com/overhoringen/open?testId=7
- https://new.mysite.com/overhoringen/open/9?other=param&more=param should internally request https://new.mysite.com/overhoringen/open?testId=9&other=param&more=param
I can do this for the first bullet, a single parameter rewrite;
RewriteEngine on
RewriteBase /
#Prettify test
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?overhoringen/open/([^/]+)/?$ /overhoringen/open.php?testId=$1 [L]
However, I am unsure how to capture the request query at the end and then append it to the internal redirect (if present at all), without the ? still in front (to avoid open?testId=9?other=param&more=param), etc.
Help with this would just be really cool. :]