Links from Localhost not working

5,363

Based on your comment where your URLs are using file:/// paths, this is the reason.

Because you're presumably using an WAMP stack (Windows, Apache, MySQL, [PHP][Perl][etc.]) installed on your machine, it acts a server, so you will need to call actual URLs with the Hypertext Transfer Protocol, rather than disk file paths.

If you had called the file absolutely from the disk, ie, file:///C:/Websites/index.html, the URL to the other pages should have worked. However you went via localhost (the right way), instead.

Be sure to start all your URLs with http://localhost/[yoursitefolder]/ (or relatively) to avoid this issue, especially when you finally decide to upload to the web.

Also, what Moses meant was sometimes devs use a lone hash (#) as a placeholder for an actual URL, simply to create an anchor on the page. This wouldn't take you anywhere.

Finally, not part of the question, but don't use capitalised HTML tags, they're ugly and I'm pretty sure not recommended :)

Share:
5,363

Related videos on Youtube

PBD10017
Author by

PBD10017

Updated on September 18, 2022

Comments

  • PBD10017
    PBD10017 almost 2 years

    After I type "localhost" in my browser the index.html successfully loads. However any to the links on that website appear to be dead. Once clicked, nothing happens. I see the right path in the path bar (using Chrome). However nothing happens, not even a message error. I run Apache 2.0 on Windows 7. The test configuration does not give any error messages.

    I went through Apache website, I downloaded a book on Apache and I searched the internet. Any pointers what Im doing wrong?

    • PBD10017
      PBD10017 about 11 years
      Not receiving 404 pages. This is an example of the URL <A href="file:///C:/Websites/VBA_Code_Header.html">Code Header</A><BR> Not sure what URL being a hash means.
    • PBD10017
      PBD10017 about 11 years
      The issues was in the URL itself. I should use "http" instead of "file", not sure why, but it works.