SitePoint Sponsor

User Tag List

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

    Understanding HTML links

    Where would this hyperlink take me...
    HTML Code:
    <a href="finance/">Finance</a>

    And what is the difference with this link...
    HTML Code:
    <a href="/finance/">Finance</a>
    Thanks,


    Debbie

  2. #2
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Where would this hyperlink take me...
    HTML Code:
    <a href="finance/">Finance</a>
    This one would take you to the 'finance' folder relative to the folder you are in. So say you was in www.site.com/help you would be directed to www.site.com/help/finance

    And what is the difference with this link...
    HTML Code:
    <a href="/finance/">Finance</a>
    But this link takes you to the finance folder relative to the root of the site. So if you was in www.site.com/help you would be directed to www.site.com/finance
    Having an initial forward slash will always be from the root, no forward slash will always be from your relative place


    Thanks,


    Debbie
    Answered in bold, hope this helps

  3. #3
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Well, what Dan said is pretty true of paths on a Linux system, but whether your links begin (or end) with a slash is also part of how your server is set up.

    For example our local fire department site, when it was running Perl's Dancer framework (which uses routes in the way many microframeworks do), all links started with a slash. It had to do with how the routes in the config file was set up more than anything. Your particular server might also have special rules for slashes. The trailing slash in Apache at its default setup for example. There's a directive in Apache that says whether it should expect a trailing slash or not.


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
  •