Long URL Vs Short URL
We know the fact that present content available in the internet is from web applications not web site! We see many advanced Server side scripts like PHP, Perl, and Java etc. that generates most of the dynamic content on the web.
For example http://www.wikipedia.org/ is a largest data collection or knowledge base. This data can be found through URL on the web. So URL is the key point to dynamic content. Generally we do this with a dynamic parameters append to URL and fetch the data from the server according to parameter. We can also use it for short time, like user activation, forgot password, reset password. So we have some information about URL.
Here we discuss about the length of the URL of the web site. As web developer we ensure that our web application work in all web browsers, all plat forms and all server. Off course it is difficult to ensure it, but we work at least an environment like lowest version of the browser, server, and operating system.
Dyamic URL
Example URL:
http://www.maheshchari.com/products/items.php?id=x&model=y&variety=z
http://www.maheshchari.com/activatepage.php?username=x&email=y&reset=z ….etc
Disadvantages
- the length of the URL must work at least IE6, that accepts max length of 2083.
- Some servers like Apache sends HTTP 413 error, not sure it depends for different versions and plat forms.Long URLs usually break when quoted in an e-mail message, and then don’t work.
- In the above URL the data x, y, z vary to different situations, so it may exceed limit.
- It leads some times as security issue.
- user can’t remember and type the URL
Best practices
- make ensure the data is less.
- user URL shortening web services.
- encode number of parameters to single parameters.
To make small URL with PHP see how we implement it below code
encoding to Short URL
1 2 3 4 5 6 7 8 | //making uniform data length link //we encrypt user data to base 64 codeformat and urlencode format $param=urlencode(base64_encode('username=x&email=y&reset=z')); $url='http://www.websitename.com/activate.php?param='.$param; echo $url; //output is:http://www.websitename.com/activate.php?param=dXNlcm5hbWU9eCZlbWFpbD15JnJlc2V0PXo%3D //we can also use available url shortening web services like tiny.url ..etc //they provide like tinyurl.com/xeuess |
Decoding to long URL
1 2 3 4 5 6 7 8 9 10 | // decoding and parse to GET method $getparam=$_GET['param']; $decoded_param=base64_decode(urldecode($getparam)); echo $decoded_param; //output :username=x&email=y&reset=z //we delete this $_GET['param'] //re assign global $_GET variable parse_str($decoded_param,$_GET); echo $_GET['username']; //output is: x |
Static URL
Example URL
http://www.maheshchari.com/articles/how-to-become-a-rich-man-with-in-one-day-by-author-example/
http://www.maheshchari.com/articles/worlds-largest-mountains-in-india-and-other-countries-polls-for-2000/
It is a well-known fact nowadays that without SEO a Web site stands many chances of not being indexed by search spiders. that results poor conversion rate.my colleague who is SEO expert had this type issue in past, that he used like above URL in his SEO or search engine optimization as it gives more chances of indexing in most search engine. but result is poor.but it wrong since he gave full URL and the page content is not much relevant to this URL. it may leads some times penalize or some times it may be spammed.
Best practices
- Keep URL small as possible as less than 5 to 6 words and make it for human readable not for bots
- Keep URL most relevant to the content.
- Keep highest keyword starting position even though grammatical mistake.
- There is some online web services available that suggests URL according to the content.
- Use URL shortening web services while campaign .









Related Articles
1 user responded in this post
Awesome, thanks for the tips!
Leave A Reply