| | | | |
html hit counter
search
 
SEO Checklist ($19.95)
Improve your search engine ranking. Click here

Web Directory
Add your website to the iWEBTOOL Directory.
Click here

Market  NEW!
Buy, sell or trade webmaster related goods. Click here

DollarLinking
Buy a Link for $1.00 per year. Click here
Sponsored Links
Funny Games
Online Pokern
AirSylhet
Casino
Music Download
Web Hosting from $4.99
San Diego Dentist
nakliyat
Remortgages

Add your link here
Only $40 per month

You are here: Articles > Web Design & Development > In 2 Lines: Optimize Your URLs With Dynamic Content:


In 2 Lines: Optimize Your URLs With Dynamic Content:
Search engines like Google weigh heavily the content of URL keywords and structure. A URL like
"domain.com/page.asp?Id=5&SubmissionDate=4152006" won't be too friendly to a search bot - OR a human.

Sites like www.digg.com have this type of SEO in place: each news item, for example, has a URL that includes (part of) the title of
the news item in it. You can do this with your site's dynamic content very easily.

If you have a lot of articles, maybe a database of recipes, or some type of dynamic, user-generated content that you want to rank
high in the search engines, this method will work very well! iWEBTOOL's article pages use a similar - but not exact - method.

If you run your website on a Linux server with Apache, you can make a file called ".htaccess" and stick it in your public_html
directory.

In that file, put the following 2 lines, as an example:

RewriteEngine on
RewriteRule ^recipe/(.*)$ /recipe.php?id=$1

This is the code taken from www.foodalicious.com's .htaccess file. It makes the recipes have friendly URLs. Example:
http://www.foodalicious.com/recipe/Apple_Cinnamon_Pancakes

Here's what those 2 lines of text actually do:

1. First you have to turn on the Rewrite Engine. That's easy to do.

2. ^ means at the end of the domain part of the URL, so www.foodalicious.com/ in this case. Thus,

^recipe/

Means: www.foodalicious.com/recipe/

The best part? The directory "recipe" does NOT need to exist - in fact, it shouldn't. So we've gotten that far, now we need to get
the dynamic part of the URL in somehow. That is done with: (.*)$

The $ means the end of the friendly URL. Now, we need to tell Apache what script to run to get the dynamic content. Basically, in
this case, it replaces:

foodalicious.com/recipe.php?id=4

And makes it this:

foodalicious.com/recipe/Name_of_recipe

So we need to put recipe.php in the public_html directory. Of course, this is the file that actually displays the recipe.

Therefore, the next part of our .htaccess file tells Apache what file to actually execute:

/recipe.php?id=$1

$1 simply means the first variable in the query string of the URL... so if you had:

file.php?a=3&id=2

Then, $1 would return "3" and $2 would return "2".

That's pretty much all there is to it. It's very easy, and although this is a basic example, it can be applied numerous ways.

The only things you need to filter from the URL are wierd characters like punctuation, and spaces. Replace spaces with a _
character, usually.

Enjoy the high search engine ranking!
 
Source: http://www.mattsprojects.net
Date: 16th April 2006
 
Return to Web Design & Development
Discuss this article in our webmaster forums
 

Help & Support - Advertise - Copyright © iWEBTOOL 2005-08