Broken Links

I am a newbie. I have just read Build Your Own Website The Right
Way by Ian Lloyd and I am having a problem with broken links on my website.
I created a website which works perfectly on my laptop but after uploading
the website using FileZilla FTP to my ISPs server I have found that none of
my links work. I have validated both my CSS and my XHTML using the W3C
validator tools and found no errors. Please could you suggest what has gone wrong?

Check your links code, i`m sure your links are absolute related to your computer, like this: <a href=“file:///C:/pictures/xyz.jpg”> so they are searching for drive C:\, on your pc. Your links should be relative, like <a href=“pictures/xyz.jpg”> , so they will search on your server. Could also be absolute or root-relative , but to your website (<a href=“”>)

Hi jonathanbarton. Welcome to the forums. :slight_smile:

If webcosmo’s answer doesn’t help, please post a link to your site, or at least an example of the code used in your links. :slight_smile:

Try right click on your online images and look for image source or image details and the online path to the image should be displayed.

super glue?

…no wait, you meant web links…:smiley:

Hi jonathanbarton. Welcome to the SitePoint

it is likely that you built your site using absolute links ( possibly using Dreamweaver?). So when you the files to yours server your links are wrong( the HREF string didn’t change, but the server wouldn’t have an idea of where “http://mycomputer/c-drive/webpage/index.html

Go back an check your links if the HREF begins with “http:” or “file:” you have used absolute links!

Unless you are building your site directly on a server ( and NEVER expect to move it to another location) it’s almost always better to use relative links.

href=“index.htm” ( a file in the TOP directory of your site, linking to INDEX.HTM file which is ALSO in the top directory)
href=“folderName/file.htm” ( a file in the TOP directory of your site, linking to FILE.HTM , file resides in folderName, folderName in the top directory)
href=“…/other.htm” ( a file , linking to other.HTM…which is in a parent directory )

hope that helps

Hello Ralph.M. As far as I can make out I am using relative links at the moment. I copied my code below:

<li><a href=“index.html”>Home</a></li>
<li><a href=“about.html”>About Us</a></li>
<li><a href=“events.html”>Club Events</a></li>
<li><a href=“contact.html”>Contact Us</a></li>
<li><a href=“gallery.html”>Image Gallery</a></li>

The url of the website is:

If you visit the website you will see that I cannot get the links to work. Do you have any other suggestions?

OK, so the question we need to ask now is—Where are those pages currently located on your server? They should be inside the /jonathanbarton1/ folder, but they aren’t there. (Are you sure you have uploaded them at all? Check in your FTP program to make sure they actually got uploaded.)

(Note also that in your online version of the menu, you have a gap before the gallery URL:

<a href=" gallery.html">

Remove that gap before the g or you will have a problem with that link.)


I just did some fishing, and discovered that the reason your links are not working is that your file names start with a capital letter (e.g. About.html) while your links point to files without a capital at the start (e.g. about.html). As a rule, never use capital letters in HTML or CSS code. It’s just one more source of trouble you can do without. :slight_smile: )

Thanks for that. It is now working.

No worries, glad we could help. :slight_smile: Do come back if you have more questions. :wink: