Do we need http://www or / in URL?

Discussion in 'JavaScript' started by FutureKing, Mar 16, 2009.

  1. #1
    Hi,
    I am developing a social bookmarking application. Currently I am working on Link Submit Module.
    The Objective: User can not submit duplicate URLs.
    Solution: A URL can be written in the following 2 ways:
    http://www.yoursite.com
    http://yoursite.com
    There may be "/" present in the last. e.g. http://yoursite.com/
    I have written a script in javascript for removal of "/" from the last and removal of http://www and http:// from the beginning. "http://www" will be automatically added when end user will see URL.
    This will make URL look like yoursite.com
    it means if user added http://yoursite.com then he/she will not able to add http://www.yoursite.com. Because in the database it will become yoursite.com.
    Question
    I want to know that is this possible that http://yoursite.com and http://www.yoursite.com become different? Is "/" in the last necessary?

    Please Help.
     
    FutureKing, Mar 16, 2009 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    / at end is not necessary avoid it

    yes its possible to show different content for www and non-www using .htaccess

    Regards

    Alex
     
    kmap, Mar 16, 2009 IP
  3. FutureKing

    FutureKing Well-Known Member

    Messages:
    194
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    125
    Digital Goods:
    4
    #3
    thanks. I will update my program
     
    FutureKing, Mar 16, 2009 IP
  4. NoJster

    NoJster Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As kmap pointed out, www. server.com may be different from server.com or *. server.com, depending on the web servers configuration.
    A single / might be neglected, but // can make a difference to
    www. server.com/ and
    www. server.com// might link to different kind of content as well.
     
    NoJster, Mar 16, 2009 IP
  5. FutureKing

    FutureKing Well-Known Member

    Messages:
    194
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    125
    Digital Goods:
    4
    #5
    thank you. thank you very much for your help:)
     
    FutureKing, Mar 17, 2009 IP
  6. sai_510

    sai_510 Peon

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yup as already mentioned "/" is not necessary, but presence/absence of www is definitely important, for some www is important but others may prefer w/o www.
    I don't use www in my weblog !
     
    sai_510, Mar 17, 2009 IP