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 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.