How to recover everything after the "?" in RewriteRule?

0

I have the following rule that was created by another programmer and that is working in some processes:

RewriteRule ^chk-error/(.*) chk_err.php?error=$1 [L]

It retrieves everything that comes after chk-error/ and puts it inside error to be treated inside the chk_err.php file. It works normally.

But I will need to use the same page chk_err.php and the URL that will access this path will come with a question mark. So:

https://www.example.com/chk-error/?errcat=5&errcd=514&id=12&in=gt5

I would like to adapt so that she can recover everything that comes after the interrogation "?". Without breaking the previous process.

What would be the new RewriteRule with the "?" being optional?

In summary I wanted to rewrite the RewriteRule that is working to retrieve this URL:

https://www.example.com/chk-error/errcat=5&errcd=514&id=12&in=gt5

In order to retrieve this other URL pattern:

https://www.example.com/chk-error/?errcat=5&errcd=514&id=12&in=gt5

Note that the difference between them is only the question mark "?" after chk-error/ .

    
asked by anonymous 08.06.2017 / 14:39

1 answer

-1

Is this the only rule the URL goes through? If I get it right, you just have to deny the ? in the rule and everything should work the way you want it.

RewriteRule ^chk-error/(^?.*) chk_err.php?error=$1 [L]

    
09.06.2017 / 04:48