SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict
    Join Date
    Sep 2011
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URLs - use "-" or not (your opinion)

    Hi, i am trying to decide what i should rename all of my urls to.

    I am going to remove all the ".html" endings but what is your opinion on the following:

    Should i use "-" or not... for example:

    /sign-in OR /signin OR /sign
    /create-account OR /createaccount OR /create
    /my-account OR myaccount OR /account

    What is your opinion on the above, what naming mechanism should i use, thanks in advance...

  2. #2
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,914
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oo7ml View Post
    Hi, i am trying to decide what i should rename all of my urls to.

    I am going to remove all the ".html" endings but what is your opinion on the following:

    Should i use "-" or not... for example:

    /sign-in OR /signin OR /sign
    /create-account OR /createaccount OR /create
    /my-account OR myaccount OR /account

    What is your opinion on the above, what naming mechanism should i use, thanks in advance...
    Interesting question for admin pages.

    For things like articles I would do...

    Code:
    articles/why-you-should-start-your-own-business-today

    Debbie

  3. #3
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,101
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I guess this is a SEO question and I just got finished with a bit of research on that topic.

    Use a hyphen, Google interprets sign-in as sign in whereas sign_in becomes signin to the results.
    If you don't have any keywords in your URL (you should) you can go without the hyphen but your URL's look funny, sometimes if you group words together you get a middle word that may be undesirable, also try to pronounce signin as one word.

    My 2c
    What I lack in acuracy I make up for in misteaks

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lorenw View Post
    I guess this is a SEO question and I just got finished with a bit of research on that topic.

    Use a hyphen, Google interprets sign-in as sign in whereas sign_in becomes signin to the results.
    If you don't have any keywords in your URL (you should) you can go without the hyphen but your URL's look funny, sometimes if you group words together you get a middle word that may be undesirable, also try to pronounce signin as one word.

    My 2c
    Yes; hyphen is considered as space by google. Hence, it is advisable to use hyphen to separate words in urls.

  5. #5
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    I just find it amusing that NOBODY uses the actual official spec for doing this - RFC-3986 because "percent signs are ugly"... or use PHP's in-build URLEncode because "plus signs are ugly".

    Personally, I prefer underscores to hyphens visually, but I know I'm in the minority on this and search engines treat underscores as literals, which is why I go ahead and use hyphens despite my dislike.

    Usually I use these to decode/encode URL's these days:

    Code:
    function urlEncodeHyphen($url) {
    	return str_replace(
    		array('-','+'),
    		array('%2D','-'),
    		urlencode($url)
    	);
    }
    
    function urlDecodeHyphen($url) {
    	return urldecode(str_replace('-','+',$url));
    }
    A simple test:
    Code:
    $testString='This is a test - or is it? 2+2=4';
    echo '
    <pre>
        raw :',$testString,'
    encoded :',$encoded=urlEncodeHyphen($testString),'
    decoded :',urlDecodeHyphen($encoded),'
    </pre>';
    Outputs the following.

    Code:
        raw :This is a test - or is it? 2+2=4
    encoded :This-is-a-test-%2D-or-is-it%3F-2%2B2%3D4
    decoded :This is a test - or is it? 2+2=4
    Safely encoding the characters that aren't allowed in a URI, using hyphens instead of plus signs for spaces...

    Though it does raise a question, how do search engines treat the PHP urlencode plus signs? The output from urlencode being:
    This+is+a+test+-+or+is+it%3F+2%2B2%3D4

    For the above test string.

  6. #6
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    I always like URLs to be as short as they can without losing information. So "My account" would be /account and "Create account" would probably be /create.

    If you've only got a couple of words and you're not going to run into the "Pen Island" problem, there's no real harm in leaving the hyphen out, but once you get beyond that, run-in becomes difficult to read and parse, eg website.com/pagenamemadeupoflotsofwordsstrungtogether. Google will probably be able to make sense of that, but people will struggle, so you need some kind of word delimiter.

    The biggest problem with underscores is that when the URL is typed, it is usually underlined, and it isn't always obvious to the uninitiated when you see website.com/page_name_with_underscores that those are underscores and not spaces.

    So by a process of elimination, most of the time you'll be best off using hyphens to separate words in the URL.

  7. #7
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stevie D View Post
    but once you get beyond that, run-in becomes difficult to read and parse, eg website.com/pagenamemadeupoflotsofwordsstrungtogether. Google will probably be able to make sense of that, but people will struggle, so you need some kind of word delimiter.
    Which is an EXCELLENT point -- write for people, NOT the search engines. All the black hat SEO BS in the world is pointless if the result isn't useful for PEOPLE.

  8. #8
    SitePoint Addict
    Join Date
    Sep 2011
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool, thanks for all your help guys... much appreciated...

  9. #9
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use hyphen in url but only one time not use more and more time in URL.

  10. #10
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by David Anderson View Post
    Use hyphen in url but only one time not use more and more time in URL.
    what? where did you come up with this?

    sure sounds like nonsense to me
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  11. #11
    SitePoint Member
    Join Date
    Sep 2011
    Location
    Dandenong
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, As per my opinion we never use hyphen cause i think crawler consider hyphens as a junk character. and little bit negative impact on this. I'm not sure about this. i just explain what i think. might be i'm wrong. Hope you understand my point of view.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •