Jump to content

Best way to set links


Recommended Posts

Just want to ask what is the best method for linking within a site. If it makes a difference at all.


If my home page is mysite.com (index.html), and I wanted to make a contact us page. When I add a Contact Us link to the home page, would I only need to have the link as contactus.html, or would I be better served using the full URL, such as <a href="http://www.mysite.com/contactus">Contact Us</a>.


I hope I explained that ok.



Link to comment
Share on other sites

I tend to prefer to use relative paths (contactus.html) rather than using the full path since if for some reason the URL changes (for example, I'm developing the site on a development server, and once it's finished it will be transferred to a different URL) that won't mean I have to fix all the links. Also, saves me a little bit of time and keeps my code shorter. It is a personal preference thing though -- I don't believe one method is necessarily "better" over the other.

Link to comment
Share on other sites

I'd agree with Ben. In addition to the benefits he mentioned, it also means you don't have to find/replace every link if 'someone' decides to change the domain name at the last minute (www.mysite.com to, say, www.mygreatsite.net). ;)


Hope that helps!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...