Forum Moderators: open
My question involves the path of these URL's. I have come up with an idea.
The urls to each story are generated dynamically in my script. Therefore, I can give them whatever path name I choose and parse this path to arrive at what I need to find the story in the database. This requires knowledge of server side scripting and, in my case, Apache, which I think some you may have a good grasp of.
Which is best?
www.xyz.com/topnews/e456d233/
(the hexadecimal number is the id used to retrieve the story from the database)
or
www.xyz.com/topnews/e456d233/barton_school_board/
(google will interpret this as one additional directory as compared to the first URL.)
or even
www.xyz.com/topnews/barton_school_board/e456d233/
Note that all I did was append a portion of the story title to the URL - it is not actually used to find the story in the database. All it is used for is the search engine hopefully picking up on these keywords.
So, do you think the longer path is warranted or is it better to stick with the shorter one that does not reveal the title of the article?
Thank you in advance,
TheWebographer
You should have no trouble ranking with just the id #.
If you really want to keep the KWs and not go a level deeper into the directory, use a delimiter to separate the id from the title. Then, explode the variable just before building the database query.
www.xyz.com/topnews/barton_school_board-e456d233/
I would strongly suggest that if you want to incorporate keywords in a filename you use hyphens rather than underscores. Try doing a Google search for allinurl hotels location (preferably a major tourist destination), you will find lots of hyphens in the domain and file names, but no underscores!
Instead of a underscore, a hyphen seems to be beter. See these threads: Hyphen or Underscore? - what's the best keyword delimiter? [webmasterworld.com] and hyphen or underscore? [webmasterworld.com]. For Google 'barton_school_board' counts as one word, where as 'barton-school-board' is seen as 3 words ('barton', 'school' and 'board').
<added>Mohamed_E just beat me</added>
I also believe that the shorter the path the better.
I assume you're using the hex number to keep the URL smaller than a decimal number?
If PHP is your scripting language, you can easily go up to base 36 rather than 16, by using base_convert(); and it can still be easily changed back
Taking it a little further, you could use up to the number of characters allowed in the Rfc2616. That way youre hex numbers would be half the size or smaller. Using letters (upper and lower case) and numbers would be OK IMO.
Maybe if youre ID's from the DB were to be converted easily into words you could just drop the number and use the keywords :)
Thank you for your ideas.
The problem with using keywords is that we have a large number of news stories being posted every day. And the online editors are a bit lazy to think up keywords.
It is easier if each story is just assigned a unique id - if keywords are used there is a chance over time of having two articles posted with the same name, such as two stories like "www.xyz.com/top-news/car-crash-kills-two/".
I could guard against this in the script, not accepting a story with the same keyword combo as one that already exists, or perhaps appending a "2" or something to the end of the second story.
Another idea is to use a keyword and id combo such as "www.xyz.com/top-news/car-crash-kills-two-344d1ce5/". In fact I am kind of leaning toward this.