Introduction
URL rewriting can significantly boost your website’s search engine friendliness by changing the long, unreadable, and tough to remember URLs to convenient and succinct names. There are a lot of guides to be found on the Internet, but none come even close to this one. This post is a comprehensive know-how for URL rewriting.
Uniform Resource Locator or URL foe short is the address to your website through which a user can visit your site using the Internet. There are two types of websites – Static and Dynamic. Thus gives rise to two types URLs with the same names respectively. The Static URLs are easy to understand and remember as they are hard written by the webmaster during the Static webpage generation. The problem arises in Dynamic URL writing. A Dynamic URL tells the site exactly what information to show to the user by including variables in the URL itself. It is these variables that make life difficult and create misery in reading these URLs by the user as well as the browser. A typical Dynamic URL looks like this:
http://www.google.co.in/#hl=en&q=hello+world&meta=&aq=f&oq=hello+world&fp=c5b9ba6cbe6cba1e
As you will see these URLs do give us the nightmares, so webmasters have come out with a solution for this by introducing a technique called URL rewriting wherein the obscure Dynamic URLs are rewritten to match their Static counterparts. The cleaner and shorter version of the URL is much easier to read, understand and remember. The URL must tell you what page or file it refers to and the rewritten Dynamic URL does that precisely. Search engines and users alike get all the useful information they require from these cleaner URLs. A typical rewritten Dynamic URL will look like this:
Now, clearly, one can read and correctly predict what the URL might be referring to – in this case the Google search for “hello world”. The former longer and absurd Dynamic URL too refers to the same page (follow the link to see where it points), but could you decode it at the first glance, majorly no. So now that we have laid foundations of what is URL rewriting and why to do it, we shall delve further into the tools and techniques of URL rewriting.Remember hyphens are treated as spaces by the search engines while underscores are not, hence remember these thumb rules, as you would like to remember them as, while rewriting Dynamic URLs.
Web Server Support
Before launching ourselves into the core of URL rewriting we shall discuss about the web servers that your websites run on and their support to understand your rewritten URLs. One thing to mention here would be that unlike the search engines, a server cannot easily understand rewritten URLs and thus, they have to be in a sense “translated” to be understood by the server. In order to do that all you need to do is provide an access to your rewriting module for the web server. The access depends on what server you are using.
If you are using the Apache server, there is no need of granting an explicit access to your URL rewriting module as the Apache server comes with its own in-built URL rewriting module – mod_rewrite enabled. This is hassle-free working with URL rewriting and uploading correct formatted files to your Apache server. For more information on mod_rewrite module, its enabling and working, there’s a forum here.
Now, seemingly, the Microsoft IIS is the devil that you may want to avoid while rewriting a URL. IIS does not have the default URL rewriting capability as that of Apache. But nothing to worry here, as the IIS does support add-ons that give it prosthetic URL rewriting capabilities. One closest to mod_rewrite is the ISAPI_Rewrite add-on for IIS. To understand the installation and configuration of ISAPI_Rewrite please visit its online instructions manual.
Basics of URL Rewriting
Before all you may ask why do all this perspiring work? Well, the main thing we target here in rewriting a URL is making it search engine friendly. Our website should rank higher up the Google index. Google likes, no wait, Google loves a well-structured folder hierarchy. So to play the SEO game, we need to play by the rules and follow Google’s nomenclature system.
Up till now you have learnt all about what a Dynamic URL is and why and how to rename it. Another thing to remember is that the name changing has to happen internally on the server, i.e. the address bar on the browser will be showing the old long, and monotonous URL even when you click the smart new one. The server will redirect all requests in the name of rewritten URLs page having the older version of the URL – the Dynamic version. This can be done by modifying the .htaccess documents.
The last thing to mention here is the common mistakes that people tend to make while rewriting URLs. Please keep the following points in mind as not doing so may result in a fatal broken link and your webpage could disappear from the Internet, even though it shows on the server.
- Session IDs: What are those? e967ef2d7f923aab20e10ddb4164a351 ? It’s a session ID. It’s different for every user so every user has a different address.
- Apostrophes and other special characters: %e2%80%93 – This is an apostrophe in a URL.
- Numbers instead of speaking URLs: Decide, 123 or full-website-sitemap, which URL speaks your language, which one you’ll rather click?
- Multiple URLs for one page: www.example.com, example.com, example.com/, example.com/index.php, example.com/index.php? All leading to one homepage? No you have 6 homepages and counting! Use a canonical URL script (WordPress 2.5 already does by default).
- Too many parameters which also change randomly. Dozens of combinations are possible for passing parameters. This is even worse than the point above.
- Use only relevant keywords in URL.
- Avoid too many subdirectories or huge link depths.
- Changing URLs after publication: It is really silly to change URLs after publishing a page and getting traffic on it.
Tags: URL rewriting
Thanks for this educative entry. I am always searching for knowledge on different subjects and it’s seldom far away on the net. I’ll be coming back soon.
I really like when people are expressing their opinion and thought. So I like the way you are writing
No excuses; one must leave comment after reading. That is what keeps the bloggers going besides many other things.
Your website is great. I m gonna read more, thanks. Keep working on it.
This post is beyond awesome. I am always wondering what to do and what not to do so I will follow some of these tips.