Guys trust me, I am not kidding!! I have had my experience, telling people about URL, parts of URL, query string, SEO friendly URL, canonical URL.

Once again, a simple and innocent question “What is URL?”

Internet is a world in itself and each resource can be located by an address which is called as URL:uniform resource locator. Though it is self explanatory but you can read more here.

How this works actually? We will take an example and try to explain it in our own usual way.


http:// - Hyper Text Transfer Protocol

A protocol is a standardized means of communication among machines across a network. Equivalent form exists in our world,just look at our daily communication through mails,posts,couriers. Other common protocols can be https,ftp. https is required for a secure communication like transferring money in a guarded truck, ftp is required for file transfer like movers and packers . Lets consider,we post a mail.

codespread.com - Domain Name

We require an address where this mail should reach so at the front of the envelope we write a unique address. Similarly we have a unique domain name to identify each website.

/2012/10/28/know-your-url/ - directories/sub-directory/file-name

Though our mail will reach the correct address but still it should reach the concerned person.It should move across the structure to reach the exact recipient  Similarly, our URL should open the exact webpage which might be located inside a directory or sub-directory.

Lets see,what is this query string?


The ? operator separates the right side character string in the URL which is called as query string. They appear in a key-value pair like here key is ‘sort’ and its value is ‘true’. Query string is useful, in case, when on reaching a webpage, we require some additional activity to happen. In our case we require sorting.

Not all the characters can be used in query string.To show that, I want to include some useful information related to URL encoding from Wikipedia here.

In particular, encoding the query string uses the following rules:

  • Letters (A-Z and a-z), numbers (0-9) and the characters ‘.’,'-’,'~’ and ‘_’ are left as-is
  • SPACE is encoded as ‘+’ or %20
  • All other characters are encoded as %FF hexadecimal representation with any non-ASCII characters first encoded as UTF-8 (or other specified encoding)

 SEO friendly URL

SEO is Search Engine Optimization. We all know Google is the search engine that most of the world uses and to make indexing of your website better , SEO friendly URL is one of the options .Few basic rules that needs to be followed to make URL’s search friendly.

  • Keep URLs short
  • Use hyphen to separate words
  • Use lower case letters
  • Avoid parameters/query strings
  • Language based links

Canonical URLs

Canonical URLs is applied to avoid any duplicate URLs indexing by the search engine. Lets see, if our site contains two pages with same content then they are considered to be duplicate and only one of them will be considered for indexing. It can be equivalent to that your post-mail reaches the address and opened by the owner. Although, members are there in the family but the mail is addressed to the owner only. Not that much confusing. :)

Its a bit tough job to avoid any technical terms in the blog and I am still learning so please share your feedback or ideas for improvisation.

Author: hershey


Share This Post On


  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    Can you help, please ?

    Post a Reply

Submit a Comment



More from CodeSpread:

  • WCF Part 1: Why WCF?WCF Part 1: Why WCF?When i create a WCF service, i feel like it is a very easy task but when somebody asks me, why you have created it? then the simplest answer is, i got the requirement like this. But to be honest, N...
  • Difference Between Transport and Message Security in WCFDifference Between Transport and Message Security in WCFTransport Security in WCF As the name suggests, it is concerned with security of communication between client and the service over a network protocol. It guarantees the confidentiality and integri...
  • Time Out: Not a Technical postTime Out: Not a Technical postTaking my time-out from technical world for once and sharing a regular joke in the form of  this comic with you. There is no harm in showing funny side also sometimes. wat say!!
  • WCF Part 2: Fundamentals.WCF Part 2: Fundamentals.We have seen the evolution of WCF in our previous article: WCF Part 1: Why WCF?. Next, we will go through the fundamentals of WCF. I will try to make it more worthy than an interview question puff....
  • Security Leak: Session Fixation vulnerabilitySecurity Leak: Session Fixation vulnerabilityWhat is a Session? HTTP is a stateless protocol. Each request to the server is independent and does not contain any information about the user like who has requested which page or any information/...