Results 1 to 6 of 6
  1. #1
    TravG's Avatar
    TravG is offline Private Member
    Join Date
    September 2008
    Posts
    2,069
    Thanks
    34
    Thanked 179 Times in 131 Posts

    Default How to Link to Homepage

    I am curious how most webmasters link to their homepage. Looking through my one website I noticed how I link to my homepage is not very consistent. Some links simply use a slash like "/", some use the entire url like xxhttp://www.xyz.com and others use the url with a trailing slash like xxhttp://www.xyz.com/

    Does it really matter how you link to your homepage as long as you are consistent? And does consistency really matter? My thinking is it probably does not really matter how you link to your homepage as long as you are consistent across your entire website. Would you agree? Thoughts?
    Live Casino USA - the best USA live online casinos. Play USA online slots and other casino games like USA online blackjack. Play See USAlegalcasinos.com to find the best USA online casino. Want to play USA online poker? Find the best poker sites at 4DeucesPoker.com.

  2. #2
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,159
    Thanks
    4,605
    Thanked 9,350 Times in 6,026 Posts

    Default

    I usually try to use absolute urls (with the http://) and usually use the trailing slash.

    Back in the day when people first starting stealing websites, some were real idiots and would copy and paste the entire thing, using absolute urls made stealing the site more difficult for them, and we saw some who would put stolen sites up using our urls.....lol

    Also, when using absolute urls there is never any question in a template whether there needs to to be ../pagename or just /pagename so that simplifies that a little also.

    I think years ago some browser would have issues without a trailing slash when going to the root, but I think that is less of an issue now, but as long as the web server presents the default page properly why not use it?

    Back when toolbar meant something I think there was a slight advantage to using the full url with the trailing slash, so some usage might be to keep consistent with what is done throughout the rest of the site.

    Rick
    Universal4

  3. The Following User Says Thank You to universal4 For This Useful Post:

    TravG (9 November 2015)

  4. #3
    martinseomcgarry's Avatar
    martinseomcgarry is offline Private Member
    Join Date
    September 2013
    Location
    Leeds
    Posts
    86
    Thanks
    14
    Thanked 38 Times in 23 Posts

    Default

    I need one more post to show you examples of links -as i'm a newbie! Ignore this and read the next post!

    Does this help?


    Examples of links to the home page (not recommended)

    <a href="../home.html">Home</a>
    <a href="index.html">Home</a>
    <a href="/index.php">Home</a>


    Examples of links to the root URL (recommended)

    <a href="../">Home</a>
    <a href="/">Home</a>
    <a href="http://www.example.com">Home</a>
    <a href="http://www.example.com/">Home</a>

  5. #4
    martinseomcgarry's Avatar
    martinseomcgarry is offline Private Member
    Join Date
    September 2013
    Location
    Leeds
    Posts
    86
    Thanks
    14
    Thanked 38 Times in 23 Posts

    Default

    On a side note - i'd make sure you have a server rewrite in place, so if you do use variants of your root, the server sends the user to the same place every time. An apache server will have this in the root htaccess file

    RewriteEngine on
    # Redirect users to "www" if necessary:
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

    And put a canonical tag in your head section of your code

    <link rel="canonical" href="http://www.yourwebsiteaddress.com/" />

  6. #5
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,159
    Thanks
    4,605
    Thanked 9,350 Times in 6,026 Posts

    Default

    I approved your posts martinseomcgarry,

    One thing I would add to that is that if you do in fact use the rewrte to send all traffic to the www, be sure any (absolute) links you use going forward use the www, since sending traffic to the non www page and then redirecting to the www is kinda redundant and adds overhead to the server(although each redirect is small, the more you save on those small packets the better you are long term).

    Rick
    Universal4

  7. #6
    martinseomcgarry's Avatar
    martinseomcgarry is offline Private Member
    Join Date
    September 2013
    Location
    Leeds
    Posts
    86
    Thanks
    14
    Thanked 38 Times in 23 Posts

    Default

    Quote Originally Posted by universal4 View Post
    I approved your posts martinseomcgarry,

    One thing I would add to that is that if you do in fact use the rewrte to send all traffic to the www, be sure any (absolute) links you use going forward use the www, since sending traffic to the non www page and then redirecting to the www is kinda redundant and adds overhead to the server(although each redirect is small, the more you save on those small packets the better you are long term).

    Rick
    Universal4
    Agreed!

Posting Permissions

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