How to Rewrite URLs for Making them Comprehensible and Search friendly rating not rated
SoftXML
                  Programming Books
                Open Web Directory
           SoftXMLLib | SoftEcartJS
xml products   Home page    contact    site map
Contact Us
Latest Blog Articles:   Latest SEO Articles | RSS Feed
DOM manipulation best practices
JavaScript Module Pattern
How to start developing with the Nextjs
Angular application structure
Write Guest Articles
Articles Archive




Loading...

The Art & Science of JavaScript ($29 Value FREE For a Limited Time)
The Art & Science of JavaScript ($29 Value FREE For a Limited Time)









How to Rewrite URLs for Making them Comprehensible and Search friendly


Why does the need to rewrite URLs 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.

Let’s elucidate this with the following example. Suppose you have written an article on ‘Best winter getaways in India’, and when you publish it, the URL looks like:
http://www.funntoread.com/article_id=474

Now, here is a URL that proves to be of no value to the website. Why? Because it does not talk to the search engine algorithms. Google loves keywords, it loves them to bits. And URL is easily the best place to for them to be included. The above URL might very well be taken as an encrypted web address that gives users and search engines least idea of what it represents and what content is written under it. This would act as a tailback for the search engine crawlers that are likely to bypass this url.

Moreover, one cannot communicate it to someone verbally, for the simple fact that it cannot be committed to memory. So, how do you make things more amiable for search engines and users alike? Just rewrite the URL to make it look like:
http://www.funntoread.com/best-winter-getaways-india

Though, this is a longer URL, but that should hardly bother you since this extra length brings along surplus benefits for you to enjoy. Since, I have been dishing out the sermon on search engines, let’s start with how it helps you there.

A certain David (your target customer) plans to tour India and is looking for the most recommended places for the season. You article is meant for him n the first place since he is most likely to type into the search engine box, “best winter getaways in India”. Now, irrespective of how much have you stuffed your article with keywords, the search engines are definitely going to identify with the rewritten url as all the relevant keywords – ‘winter’, ‘getaways’, ‘India’ find a place there. Thus, your article stands a good chance of being displayed among the top search results (of course, that also depends on how rich if your post in respect to the quality content and the requisite keywords). The cleaner URL makes it easier for folks to pass it on verbally as well.

Starting with the Root-Level

How to Make the URL more Comprehensible to the Server

While, doing what we explain above might be deemed to be a straightforward task, there is a lot of obscurity to the way it is implemented. The server your website is running must be able to identify with the tweaked URL, and there is a line of steps to be executed for ensuring that.

If, for instance, one of the posts on your site has the URL:
http://www. funntoread.com/movies-full-list-21.11-2012.php
Again, this sort of URL includes unnecessary muddle. To facilitate more readability, you need to modify it like:
http://www. Funntoread.com/movie-list/

In order to carry out this rewrite, you must communicate to the server to internally redirect all requests for the URL "movie-list " to " movies-full-list-21.11-2012.php". Firstly, 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 movies-full-list-21.11-2012.php. This .htacess file serves as the configuration file. What this does is that it directs Apache to turn on the rewrite module and also anchors the rewriting process to run in a clean manner. The following lines can be appended to the file:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^movie-list/?$ movies-full-list-21.11-2012.php [NC,L]

More Advanced Methods to Rewrite URL

Rewriting Modules

There is no need to grapple with doubts as you have the access to several rewriting modules to aid you in the process. At times, the server may be leveraging some software that will hand you over a direct access to those modules. Upon using them, you can seamlessly change the URL to how you deem it right. 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.
LoadModule rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c

This will empower you to create significant edits in your URL to make it more comprehensible to the reader and the search engine algorithms. It will also prove to be a decisive factor 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

Go the PHP Way

The .htaccess file you created should be embedded with:
FallbackResource index.php
Then, to make sure that the URL is parsed with greater convenience and flexibility, the following code will work:

$path = ltrim($_SERVER[`REQUEST_URI`], `/`);    
$elements = explode(`/`, $path);                
if(count($elements) == 0)                       
    ShowArticle();
else switch(array_shift($elements))             
{
    case `Display-content`:
        ShowImage($elements);
        break;
        

With a number of methods at your disposal, rewriting URLs should be a prospect not to be met with apprehensions and doubts. We have just presented you with the most utilizable and non-fussy techniques to rewrite URLs. Realizing how impactful a self-elucidatory URL can be, it would be recommended to get a hands-on experience using one of the techniques to make the URLs talk.

Author Bio:
Maria is a highly skilled writer with an experience of over 10 years in writing about PHP frameworks. She works for Xicom Technologies Ltd, a reliable name in the realm of Custom PHP Development services.

Tag cloud

"

Apache

URLs

access

algorithms

article

communicate

comprehensible

content

doubts

edits

engine engines

example

experience

file

getaways

Rate This Article
(votes 1)

No Comments comments

Post Comment

We love comments on this blog - they are as important as anything we write ourself. They add to the knowledge and community that we have here. If you want to comment then you�re more than welcome � whether you feel you are a beginner or an expert � feel free to have you say.



* = required
Leave a Reply
Name *:
Email *
(will not be published):
Website:
Comment *:
Human Intelligence Identification *:
What is the background color of this web page?
  
Close
Please enter a valid email Please enter a valid name Please enter valid email Please enter valid name Enter valid year
™SoftXML.   Privacy Statement  |  Article Archive  |  Popular Web Development Books
^Top