I have URL http://foo.com/bar?abc=123, what would be the correct entry in the htaccess file to return a simple text 200 status of abc=123? Basically, I just want to return the entire query string as simple text.

I know return ing text is possible because I have used it with ErrorDocument before, and I know accessing the query is possible with QUERY_STRING, I just don't know how to combine the two in a RewriteRule.


I was hoping to do this with Apache, but I did find a simple way with php.

   echo $_SERVER["QUERY_STRING"];  // Given GET /foo/bar?query, output: query

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.