Click to See Complete Forum and Search --> : Search Engine Friendly URLs


MattG
09-06-2009, 10:05 PM
Okay, I think I already know the answer to this but I thought I'd seek the opinion of others first.

I have a website which dynamically gets data from various tables within a page. I have one page which focuses on three main pieces of data in the database, the unique id, a unique name related to the id and the names of people involved in that item.

The thing I'm wondering is should I just have the unique id in the url with the php code to get the data and the info in the title and an H1 tag i.e.

URL: http://www.thewebsiteurl.com/thepage/uniqueid=1234/
Title & H1 tag: "Joe Bloggs, Jane Bloggs & John Doe in Unique Name Related to ID"

OR...

Use htaccess to make the following

URL: http://www.thewebsiteurl.com/thepage/uniqueid=1234/Joe_Bloggs-Jane_Bloggs-&-John_Doe-Unique_Name_Related_to_ID.php
Title & H1 tag: "Joe Bloggs, Jane Bloggs & John Doe in Unique Name Related to ID"

The first option is easier and sites such as IMDB use this sort of method. The second option involves a bit more PHP work but contains all the data in the URL.

Both seem to have their pros and cons but will the second option dramatically improve search engine listings or would the first option which still has all of the important information in the title and H1 tag be enough?

Thanks in advance.

rulian
09-07-2009, 01:22 AM
actually if you set up your HTACCESS file correctly it shouldnt require any more work in the PHP itself, however your PHP should be implemented knowing that your URL structure does not reflect your actual file paths.

your URL thus is free to be formatted however you like so this
http://www.thewebsiteurl.com/thepage/uniqueid=1234/Joe_Bloggs-Jane_Bloggs-&-John_Doe-Unique_Name_Related_to_ID.php

can simply becomes
http://www.thewebsiteurl.com/thepage/Joe_Bloggs-Jane_Bloggs-&-John_Doe/1234
or
http://www.thewebsiteurl.com/thepage/blogs/joe/1234
as long as it all makes sense to your program to look under the blogs category for post ID 1234 under author joe.

You can argue on a high volume site if all your doing is putting info into an H1 that eliminating a DB call via a GET variable is beneficial to your resources, however the HTACCESS method if done correctly server all it's benefits plus that of straight URL's
It does become a pain to adapt and make changes, specially when adding exceptions but konwing mod rewrite is definately worth the time taken to make it work

Weedpacket
09-07-2009, 06:04 AM
It wouldn't really make that much difference to the search engine rating (one of the design principles behind URIs is that they don't need to mean anything). The domain name helps, but after that there's not a huge amount of reason to look (just using an ID number doesn't hurt IMDB).

What does make a difference is how easy it is for people to use. Note, for example, that the first two examples that rulian showed got elided by this forum because of their length, which makes it harder to read. Now try to copy-and-paste the link somewhere.

And harder to describe to someone else without writing it down. Is that "and" or "ampersand"? Hyphens? Underscores? A plain ID number is hard to guess at (unlike, say, a wikiname) but at least it's fairly unambiguous: "dubdubdub dot eye em deebee dot com slash title slash tee tee zero zero seven nine nine four six".

The second option involves a bit more PHP work but contains all the data in the URL.
What to leave out
Everything! After the creation date, putting any information in the name is asking for trouble one way or another. http://www.w3.org/Provider/Style/URI