I have only recently started learning to make a web site. I prepared everything on my computer and then uploaded the files on the server. But now the links are not working. Also the images are not visible. Everything seems fine on my computer so why am I facing this problem on the server?
Though I assume the site was developed on a computer running Windows, most of the troubleshooting tips for the problem of links not working would also be applicable for users on other operating systems.
Based on my teaching experience, there can be many reasons why things seem fine on your local system but the hyperlinks do not work on the server. Keep your mind open to possibilities of small errors and do go through these tips thoroughly – do not take things for granted.
- Web site not uploaded to document root
On most servers, you are required to uploaded web pages and all the other files (like images) in what is called the Document root folder / directory. The web site will not load in your browser otherwise.
- Have the files been uploaded correctly?
As I mentioned before, don’t assume anything. If the hyperlinks are not working, check if the files have indeed been uploaded… and to the correct directory on the server.
- Incorrect anchor tag
Web links are created by the HTML anchor tag. Ensure you’ve used it correctly.
- Relative and Absolute URL issue
As you probably know, the HTML anchor tag (<a>) is responsible for making web links. The most important (and required attribute) of this anchor tag is href which takes a URL as a value. This web address can be specified in two ways- relative and absolute URL. Please refer that article for more information.
Absolute URLs are certainly more easy to understand. This is especially true when the web site directory structure is complex or has been over simplified by creating tens of folders. In my opinion, using relative URLs is definitely more error prone.
You should put an absolute URL in a link to test. If that hyperlink works, you can logically deduce that it’s a relative URL issue.
- Faulty file names
Your web pages may have ‘faulty’ file names. OK, they may not be ‘faulty’ because they work on your local system, but if the server runs a different operating system, it might not like the way you’ve named the files. Symbols and space characters in the file names often lead to problems. For instance, the period character should be used only once – between the actual file named and the file extension. Make sure you have only alphanumeric characters, the underscore and the hyphen in the file names of web pages and other files.
- Doubly check the values of the href attribute
Obviously, the web site links will not work if the URL is incorrect. Check these once again.
- Case of letters in file names
Probably the most common reason why the links not working problem happens is because of mismatched letter case in file names. For instance, about-us.html, About-Us.html, ABOUT-US.html or about-us.HTML would be interpreted as the same file on Windows system. But on Unix or Linux, the would mean different files. Please note that both the actual file name and the extension are case sensitive. Please check the file names on the local computer as well as the server for proper casing of letters.
- Directory names are case sensitive too
On Windows, case of letters in directory names doesn’t make a different – your hyperlinks will work – but on Unix or Linux the story is completely the opposite. Also, do not use symbols or the space character in directory / folder names.
- Web site directory structure: Another cause of links not working is when the web site directory structure on the local computer does not match that on the server. For instance, changing images directory to photos will render all the links unusable till you either revert to the old name or change each link manually.
One or more of tips should solve your hyperlinks not working problem. If not, write to me with details.