Why does the need to rewrite URL arise in the first place? Well, to begin with, the URL of a post should be comprehensible to the search engines and the users alike. For example, if your URL is something like:
You are creating bottlenecks with this sort of URL when it comes to the usability of the URL and its search engine-friendliness. Such a URL cannot be memorized, and it’s hard to communicate it to someone verbally. For the website’s visitors, it is not a pleasant romp to understand looking at the article that what the article is all about. All they see is the name of the website, which may or may not make them curious enough to go ahead and click on it.
[ Don’t Miss: Where Is Google Going with rel=author? ]
However, when you rewrite this URL to:
The user knows what he is about to read – an article about the best movies of 2010, and if that pulls his attention, he won’t think twice before clicking on it. The URL is cleaner and self-elucidatory. Moreover, a search engine like Google will read the second half of the URL as three words, ‘best’, ‘movies’, 2010’, and list your article in search results whenever a query around these keywords is entered.
That said, the URL must also be understood by the server, and you can’t simply rewrite the URL to make it work. There are certain rewriting modules you need to resort to in order to accomplish the task. At times, your server is using certain software that gives you a direct access to those modules and using them, you can effortlessly change the URL to how you fancy it correct. In an otherwise scenario, you can get some pertinent modules installed on the server.
Apache, for example, comes already equipped with a rewriting module, mod_rewrite, and it is a breeze to rewrite URL using mod-rewrite. Using this function isn’t a problem if you are running your site on a shared server, however, if you own a private server and you are using Apache1, you will have to enable mod_rewrite by making edits to the httpd.conf file.
[ Don’t Miss: Top Link Building Strategy for Google Algorithms ]
LoadModule rewrite_module modules/mod_rewrite.so
This will enable you modify your URL to make it more understandable to the users and search engines, and it will go a long way in improving the number of relevant visits to the site. In the event, you are using Apache2, you must run the following command
sudo a2enmod rewrite
There are also some add-ons like ISAPI_Rewrite which can be used to revise the URLs
Getting Back to the Basics
Let’s say one of the articles on your site has a URL
now, you would prefer to remove all the unnecessary clutter from this URL in order to make it readable, and make it look like:
For you to make it possible, you need to communicate it to the server to internally redirect all requests for the URL “poetry-list ” to “poetry-full-list-.php”. To begin the process, create a text file with the name, .htaccess. This file will contain all the instructions and it should be saved in the same folder as poetry-full-list.php. this .htacess file acts as the configuration file. This is the file that directs Apache to enable the rewrite module and also guides it how the rewriting process has to be carried out. The following lines must be appended to the file
The afore-described rule is one of the simplest and most utilizable methods to rewrite URLs. Making sure there are no errors in the intermediary processes, you can tweak the URLs so that their incomprehensibility does not let you down.