Forum Moderators: open

Message Too Old, No Replies

Experts Please... Best URL to use

best url path to use

         

TheWebographer

4:26 pm on Mar 26, 2003 (gmt 0)

10+ Year Member



I am the programmer for a successful database driven news website and would like to have individual articles place as high as possible in the search engines according to the content and title of the story. I know that keywords in the url are important. I also believe that the shorter the path the better.

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

Birdman

6:06 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think you get near as much benefit from the keywords in the file path as you do from words in the domain.

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/

Mohamed_E

6:30 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe that the jury is still out on the usefulness of keywords in filenames. I now use them, as appropriate, on newly created files, but have not embarked on a renaming of old files project.

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!

takagi

6:33 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi TheWebographer welcome to WebmasterWorld,

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>

Mohamed_E

6:56 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> <added>Mohamed_E just beat me</added>

By a full three minutes, takagi! You must learn to type faster to survive here :)

brotherhood of LAN

7:10 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



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 :)

TheWebographer

7:46 pm on Mar 26, 2003 (gmt 0)

10+ Year Member



Yes Brotherhood of Lan,

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.

Birdman

8:40 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>Another idea is to use a keyword and id combo such as "www.xyz.com/top-news/car-crash-kills-two-344d1ce5/

I heard that idea somewhere before. See message two :)

TheWebographer

8:50 pm on Mar 26, 2003 (gmt 0)

10+ Year Member



Yes Birdman, and its a great idea!

Why didn't I think of that? :-)