SEO & Friendly URLs

Posted on August 14, 2008, under SEO by Ikki.

Hi peeps,

SEO Friendly URLs. I’ve seen several forum threads and blog posts about this - so why not have my share of what my experiences are about it?

One year ago, I decided to write a Php-based blog system as a personal project to improve my coding skills and learn more about Php -yeah, back then I didn’t know about the existence of Wordpress- and I’m glad to say that I managed to create a very nice one! However, I noticed that my blog posts were barely being indexed by Google. I was scratching my head and thinking “WTF?! Maybe I did something wrong?”. It took me a couple of weeks to find out that even as advanced web crawling technology is today, most of Search Engines are still facing problems to index dynamic web pages. Damn. That were bad news. Luckily for me, a couple of days later I found out about SEO Friendly URLs.

You keep talking about this SEO-Friendly-URL thing, what is that?

The thing with dynamic pages is that their actual URL doesn’t exist at all. They are created on-the-fly based on a query string parameter passed to the browser (eg. http://www.somesite.com/catalog.php?id_of_article=1). So, if they do not exist, how can Google or any other SE pick them up?

Earlier versions of search algorithms simply would not index such URLs. Today, most of major search engines are capable of crawling these dynamic pages but they’re still having issues to index them. Some get stuck because they can’t provide the necessary info the site needs to create the page. Others simply won’t crawl the site to avoid getting trapped in it. From Google’s Webmaster Guidelines:

If you decide to use dynamic pages (i.e., the URL contains a “?” character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.

In short: dynamic pages with a long query string (eg http://somesite.com/catalog.php?id_of_article=1&model=bcx35) have little chances to get indexed -near to none, actually- so it’s best to avoid them. Short query string, however, have a higher chance to get crawled. Having said this, a question should have risen in your mind: How many characters should a query string contain in order to be elegible to be indexed?  The answer: no one knows for sure. Nor Google or any other search engine has revealed this info to anyone. Actually, they all encourage us to use static URL instead.

Search Engine Friendly URLs is the practice of replacing your query string with a more meaningful, user-friendly identifier (eg: http://www.somesite.com/catalog/1/ - can you tell the difference? - ). By doing this, you’re not only making your URLs far easier to remember to your readers / visitors but also somewhat converting your dynamic pages into static ones.

Ok, ok, I got your point. Now, how can I optimize my URLs into SEO Friendly URLs?

There are several methods to achieve this but today I’m only covering the one that seems to be the most effective (and easiest) way to rewrite urls: using Apache’s mod_rewrite module. Don’t worry, it isn’t as scary as it sounds :P

Apache’s mod_rewrite is certainly a very powerful and flexible method. However, since mod_rewrite uses regular expressions most people can get easily confused and some may even be scared away by it because of its complexity. Learning how to use it requires time and a lot of reading / experimenting so don’t take this lightly. Also, some hosting companies do not allow the use of .htaccess files due to security reasons so you have to check this before trying to use this method.

Let’s say that we had a url like “http://www.somesite.com/catalog.php?id_of_article=1&model=bcx35″ and we wanted to convert it into something like “http://www.somesite.com/catalog/1/bcx35″. Using mod_rewrite, we would put this small piece of code inside our .htaccess file:

[-]?View Code APACHELOG
RewriteEngine On
RewriteRule ^catalog/(.*)/(.*)/ /catalog.php?id_of_article=$1&ampmodel=$2

The first line of code simply turns on the mod_rewrite module. The second line contains your rewriting rule, so let’s examinate it! Each rule requires two parameters separated by a space. The first one contains the format you want to use in your URL, and the second one the original URL of your page / site.

The first parameter starts with a ^ symbol which marks the beginning of it. Next, you’ll notice a couple of parenthesis. The regular expressions inside of them indicate tagged expressions. These tagged expressions point to the variables marked with the $ symbol at the second parameter: catalog.php?id_of_article=$1&model=$2, where the $1 tag accesses the first variable passed on the query string parameter, and the $2 does the same with the second one.

This method rocks due to the fact that you don’t have to edit anything within your pages. Everything is handled by this little piece of code. Actually, this technique is so nice that Wordpress’ Permalink Manager makes use of it ;)

Why is this good for SEO? Well, as I mentioned in the beginning of this blog post Search Engines tend to index and rank static pages better than dynamic ones so SEOing your URL is a must if you’re using dynamic contents. What good is having a great site that no one can find, right? :P

Related Posts:

No related posts.

Subscribe via Email & Start Improving your Blog Today with Rauru.com!

Enter your email address:

4 Replies to "SEO & Friendly URLs"

gravatar

Wakish  on August 15, 2008

Hey ikki my friend! How you doing? ;)
This is yet another wonderful post. I remember you gave me this advice on HostBidder. ;) And I knew you were right about it. I have seen the benefits of seo friendly urls and yes it does make a difference in the way your page is indexed.
I have been very inactive for last 2months or so I think. I was quite taken by rl and my personal online game. Yeah I’m coding an online game ;) Will let you know when it’s up..
About your blog. You are growing very positively. I think I was here during the birth of your blog and watching it now, I will say you are doing a wonderful job. Keep it up my friend.
PS: This new theme is coool too ;)
(Also please convey my sincere regards to your friends which once invited me on their forum. I have not got time to be there again, but I promise I will be around soon)
Best Wishes,
- Wakish -

gravatar

Ikki  on August 15, 2008

@Wakish: Hey mate! Long time no see! I noticed your inactivity, you haven’t updated your blog since mid-july or so, nor been online on the forums :s

I’m glad to read those words about my blog. That only means that I’m on the right track :) Thanks!

Hope to see you around here and on the blogosphere again!

gravatar

Lucas  on August 17, 2008

Search engine friendly URLs are the sure way to go if you ever want to achieve success in SEO. ;) You haven’t mentioned the way to change the link structure in WordPress, but I guess most of your readers know how to do that already.

gravatar

Ikki  on August 17, 2008

@Lucas: You’re right, Lucas! I totally forgot about that :P I’ll add a small brief about Wordpress Permalinks later today.

Thanks for the tip!

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>