Monday Q&A: What is a Querystring?
As I think back to my early days on the web (I’ll date myself here) in 2000 with Headhunter.net – CareerBuilder, one of the things that I first learned about was a URL. What exactly is a URL? And furthermore, what is a Querystring? A query what?
This post is going to be a very basic introduction to some common terms in the Monday Q&A series on Online Real Estate 101.
My name is Matthew Swanson and this is my first post on the site. Having been in the internet business for just over 10 years now, I wanted to take some time and give back some of the things that I’ve learned over the past decade. Currently, I head up technology operations at House Buyer Network where we help home sellers that need to sell their house fast.
Ok, intro aside, let’s get into our content for today. First things first, some basic terminology.
URL Structure
What is a URL? The URL specifies where an identified resource is available and the mechanism for retrieving it. Basically, the URL is the friendly name for a site, i.e www.google.com. Behind every friendly URL, there is a real home (the IP Address where the resource lives).
Linking directly to an IP either in a web page, blog post, tweet, or from an email campaign is bad idea 99.7% of the time. Not to digress, but linking to an IP feels both spammy and you relinquish control of where that link goes (i.e it becomes much harder to change the destination since you are bypassing DNS. So basically the URL is the subset of the URI that you always thinking of for your favorite site (i.e Facebook.com, Realtor.com, etc…)
Now that you’re an URL expert, we’ll get to the beef, the Querystring
You probably see a querystring more times per day than you even know. But what is all that weird text up in the address bar of your browser you ask?

At it’s most simple component, the Querystring is the area within a URI that allows the Page or Website to pass data back to the web server via a GET REQUEST (or javascript on the client side) for processing. The web server can be one of many types (Apache, IIS, etc. – that’s another topic that we’ll cover in the coming Monday Q & A’s). According to the formal definition…
A URL query string allows for flexibility in retrieving data from a web server and possibly from the database used to populate pages for that web server. A read only data store, such as a weather mapping service, is one example where URL query strings can be used with great flexibility.
What that means is everytime you see a real estate listing on a website like Trulia, Zillow, Realtor.com, etc.. you’re seeing querystring parameters that help tell the page on the web server what content to show to the user.
Components of the Querystring
The way the querystring is composed is quite simple. Basically, there are a series of tag/value pairs that site developers can utilize to pass data from page to page or request to request from the end user. These pair/values can be anything the developer wants to use. There is a max Querystring length but this can vary from browser to browser. I’d say that you’re safe as long as the Querystring is < 1024 characters.
The first character that starts the use of a querystring is the ? or a #. You can see this in the example below:

Seeing a ? or a # will alert you that you’re starting to see the beginning of a querystring in a URI.
From a development standpoint, one thing that always bothered me was trying to decode the querystring since it’s always so rammed together on a URI. To that end, I wrote a little super secret querystring decoder tool over at What is a Querystring? that you might find useful.
It allows you to pass in a long querystring and then the site will parse the results and show you the data in your browser. Here’s an example snapshot from the super secret querystring debugging tool
I hope you find that tool useful, I’ve used one like it I had written in my development environment for years.
Ok, now on to something a little more advanced to help you understand what SEO URLs are in regard to the querystring.
SEO Rewriting of URLs and Querystrings
Say what? What’s that mean, rewriting what? In the paradigm shift to make pages more SEO friendly if you will, we’re seeing a lot of pages use URL Rewriting to make site pages ‘friendly’ to both human visitors and search engines. Here’s a quick example of a URL in which the ‘Querystring’ was masked using URL rewriting to look like a bunch of physical sub-directories on the web site:
http://www.realtor.com/realestateandhomes-detail/1445--Tangerine-Rose-Dr_Las-Vegas_NV_89142_1110181785
URL: http://www.realtor.com/
Request URI: realestateandhomes-detail/1445--Tangerine-Rose-Dr_Las-Vegas_NV_89142_1110181785
Note that the above URI looks like a bunch of sub-directories off the main URL. When in fact, that page is using an SEO friendly URL rewriting schema. This takes the raw querystring in the days of old and puts it in a more ‘readable’, ‘indexable’ format, etc.
That page behind the scenes is probably calling something like this:
http://www.realtor.com/ViewPropertyDetails.php?type=details&listing=1110181785
The Querystring parameters in this case above would be type=details and listingID=1110181785.
The page that processes the request can then take those two parameters and figure out what the intent of the user was based on that data. Maybe it’s showing a bread crumb trail of where the user was prior to this page. Or maybe, there is some data taken from the Querystring to show back to the user in terms of what they were searching for, etc. For the most part, doing something with the data is pretty simple and useful for end users.
One thing I definitely want to touch on that is very important from the developer side – security. At times, not so nice people can write bots, scripts, and other malicious pieces of software to hurt your site. They will do this so you need to prepared. When you look at Querystrings and the data on them, you must always take into account the user input and be sure to sanitize ANY user input as it could be malicious. Clean, Rinse, and Clean again.
I hope this post has been informative to you about the basics of the URI’s Querystring component and some very basic URL rewriting.
Please comment if you have any questions and we’ll do our best to answer them for you
Cheers, Matthew


01. Mar, 2010 








About This Author:
What’s Hot on ORE101