Fri, 05 Dec 08

A Javascript QueryString Printer

I’ve used this mod rewrite trick in the past to inspect the contents of various apache variables you have access to.

# Add this before any other rewrite rules in your apache config or .htaccess
RewriteRule .* http://foo?request_uri=%{REQUEST_URI}&the_request=%{THE_REQUEST}&host=%{HTTP_HOST}

Although useful, it’s kinda hard to inspect the variables when they’re in the URL. It dawned on me that it would be easier to see them if they were in a page in the browser itself. So, I knocked up a simple little html page that uses javascript to extract the querystring key/value pairs and display them on the page. It doesn’t look very pretty but it makes it much easier to see the content of the variables.

The page is hosted in my google code repository and there’s a splendid little screenshot below.

At the moment you’ll need to host this file yourself, but if there’s demand then I can probably make it publicly available somewhere. You can either host this file yourself or point at the version in my utilities.