In my continuing effort to successfully make my own blog I completely over looked the use of search friendly URLs. A search friendly URL is a URL that people, or more importantly, search engines can easily find and index. An example of a search friendly URL is this:
http://yoursite.com/article/url_masking_with_mod_rewrite
You can see in the above link that the title of that post is actually in the URL itself. This makes it a lot easier for people to read and for search engines to index. A lot of (smart) people look at a link or the URL of the link before clicking on it. It will inform or comfort the user to know what web site they'll be taken to upon clicking on that link. In other words, the link kind of describes the page you'll be visiting.
Now more importantly a search friendly URL allows search engines like Google or MSN to more easily find and index your pages. Here's an example of a non-friendly URL:
http://yoursite.com/index.php?page=article&action=show&id=138&url=url_masking_with_mod_rewrite
Notice in this above link the lack of any type of description in the URL. A lot of search engines will not read a URL past a certain point, like a '?' for example, or a '='. This of course can lead to search engines having a harder time finding your pages and linking to them.
URL masking by using Apache's mod_rewrite function allows us to create nicer looking URLs. If you notice in the two links above, they both take you to the same page (My first experience with AJAX). When accessing the friendly URL you are actually going to the non-friendly URL instead. But with URL masking we can hide that. Of course your server or web host has to have mod_rewrite installed in order for this to work. 99% of Linux servers have this installed, so no worries.
To get this to work, you create a simple .htaccess file in the same folder as the document (root in this case), and place the rewrite codes in there. I won't go into the specifics or syntax here, but there are plenty of good sites out there to help explain how to do this. A good tutorial site is located here, and a great cheat sheet on mod_rewrite is located here.
Of course I'm still messing around with mod_rewrite and may continue modifing it in the furture. But for now I'm happy that this step if pretty much out of the way.

April 25, 2006 1:12 pm
6807 Views

My first experience with AJAX
Be the first to comment by using the form below.