jonathanbarton — 2013-04-16T12:42:01-04:00 — #1
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?
webcosmo — 2013-04-16T18:11:52-04:00 — #2
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="http://www.yoursite.com/pictures/xyz.jpg">)
ralphm — 2013-04-16T19:58:42-04:00 — #3
Hi jonathanbarton. Welcome to the forums.
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.
john_betong — 2013-04-16T20:39:11-04:00 — #4
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.
dresden_phoenix — 2013-04-16T23:38:50-04:00 — #5
...no wait, you meant web links...:D
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
jonathanbarton — 2013-04-17T02:55:57-04:00 — #6
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="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: http://homepage.ntlworld.com/jonathanbarton1/
If you visit the website you will see that I cannot get the links to work. Do you have any other suggestions?
ralphm — 2013-04-17T03:01:35-04:00 — #7
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.
jonathanbarton — 2013-04-17T04:46:23-04:00 — #8
Thanks for that. It is now working.
ralphm — 2013-04-17T05:20:47-04:00 — #9
No worries, glad we could help. Do come back if you have more questions.
system — 2014-10-08T00:05:19-04:00 — #10
This topic is now closed. New replies are no longer allowed.