SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Characters that separate words in URL

    What is the difference between separating words with a plus ("+") versus a hyphen ("-") versus an underscore ("_") when creating "pretty URLs"?

    Are all three valid?

    What does Google think?


    Debbie

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,174
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Not exactly light reading but it is authoritative Uniform Resource Identifier (URI): Generic Syntax

    My crude distillation - any character that isn't "reserved" i.e. has "special meaning or use" is fine, else it needs to be url-encoded.

    I can't think of it's use right now, but "+' is listed as a sub-delimiter, so I guess that's out as is.

    Google? The topic has been discussed ad nauseum in the SEO forum, please Search using the vBulletin Advanced Search and SitePoint's Advanced Search

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    Not exactly light reading but it is authoritative Uniform Resource Identifier (URI): Generic Syntax

    My crude distillation - any character that isn't "reserved" i.e. has "special meaning or use" is fine, else it needs to be url-encoded.

    I can't think of it's use right now, but "+' is listed as a sub-delimiter, so I guess that's out as is.

    Google? The topic has been discussed ad nauseum in the SEO forum, please Search using the vBulletin Advanced Search and SitePoint's Advanced Search
    But what do you use and recommend??


    Debbie

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,174
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I prefer mostly letters, numbers sometimes, and if need be hyphens.

    Even though both "work", I think something like
    domain.com/hyphens-or-spaces/
    is better than
    domain.com/hyphens%20or%20spaces/
    don't you?

  5. #5
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    My crude distillation - any character that isn't "reserved" i.e. has "special meaning or use" is fine, else it needs to be url-encoded.

    I can't think of it's use right now, but "+' is listed as a sub-delimiter, so I guess that's out as is.
    This http://stackoverflow.com/questions/3...url-separators says [a-z + -] are okay.


    Google? The topic has been discussed ad nauseum in the SEO forum, please Search using the vBulletin Advanced Search and SitePoint's Advanced Search
    And what would I search on?


    Debbie

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,174
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    :d'oh: As soon as I logged out and took care of a few things my brain started working (a bit).

    The + is reserved because it it used to represent a space.

    So it's a matter of which looks better / what would be easier to remember.

    AFAIK Apache can deal with anything that meets the rfc3986 specs.

    I searched for "dash" (I'm sure you could try "underscore" or "-" or "hyphen" and find others)
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash
    http://www.sitepoint.com/forums/sear...highlight=dash

    Some of them are older, but things haven't changed.

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Folks,

    The + is a reserved character for the query string's replacement for spaces.

    %20 in a URI is how a space is represented there.

    In the case where I have a client (Welcome - Wilderness Wally's Americana!) who wants to use the title of his article as the URI, I convert those spaces to _'s BECAUSE the more common -'s can also be found in the text of the title. Since there are no natural _'s in text, they can be inserted and restored with confidence. An additional benefit of _'s is that, visually, they let the words stand out just that little bit more. For domain names, however, _'s are frowned upon (reason unknown - unless it's typing).

    Sorry folks, I've had this explanation in my tutorial article for years (although your search list didn't include the Article).

    Mitt - SPOT ON with Sir Tim Bernews-Lee's treatise on the URI Generic Syntax!

    Regards

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •