Jump to content

Recommended Posts

Posted

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.

 

thanks

Posted

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.

Posted

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!

Posted

That was actually the answer I was hoping for, but I wanted to check before I got too deep into it. It certainly will make it easier overall.

 

Thank you

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...