SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    links won't work

    every time i try to use the links on my web site i get this message:--

    The file /C:/Documents and Settings/Administrator/My Documents/WEB DESIGN/about.html cannot be found. Please check the location and try again.

    checked the code and all looks ok help please !

  2. #2
    SitePoint Enthusiast Linkoroo's Avatar
    Join Date
    Jul 2009
    Location
    linkoroo.com
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have that extra / in front. That shouldn't be there.

    Post the html code for your <a>.

  3. #3
    SitePoint Addict Belfast75's Avatar
    Join Date
    Oct 2005
    Location
    London, England
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also it can help maintain your code by using relative links. eg if you want to link between two pages in the same folder you can use:

    <a href="about.html">Link</a>

    but if you want to link to a file in another folder you can move up the folders using ../

    So if you have a folder structure set up with two folders:
    /yoursite/text/news
    and
    /yoursite/more

    and want to link to a file the 'more' folder from a file in 'news' then you can move up to levels to 'yoursite' using '../../' and then into 'more'. eg:

    <a href="../../more/about.html">Link</a>

    This way when you launch your site you won't need to change all your links from pointing to your local site to the server.

    More advanced solution
    Another solution is to set a URL as the 'root' for the site and then you can link to everything off that. This baseURL then can be quickly changed between local files and your live server location. eg

    <base href="http://www.yoursite.com/" />

    You can see more info on this at W3Schools

    Hope that helps,
    D

  4. #4
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    changed all the code for the book reference code ,links still don't work. Must be a system setting any idea's anyone ?

  5. #5
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,259
    Mentioned
    245 Post(s)
    Tagged
    1 Thread(s)
    I'm at lost here... what book reference code?

    the easiest way to work with links is using relative paths

    Imagine that I have this folder:

    C:/Documents and Settings/Administrator/My Documents/WEB DESIGN/ (sounds familiar? )

    In that folder, WEB DESIGN, I have all my html files, but then I have subfolders and files, like this (folder names in bold):

    Code:
    WEB DESIGN
    
    index.html products.html about.html other.html IMAGES
    pic1.jpg pic2.jpg pic3.jpg gallery.html
    CSS
    style.css style_gallery.css
    Now, from my index page, I want to use relative path to link to "about.html"

    Both pages are in the same folder, so when I create the link in my "index.html" page, it is easy:

    Code HTML4Strict:
    <a href="about.html">about</a>

    I don't need to specify folders, because both files are kept in the same folder.

    If I wanted to link to a CSS style, I can see that WEB DESIGN has a subfolder, CSS, and that's were the file I need is (style.css).

    Relatively speaking, from the folder where "index.html" is, I need to go down one folder to find "style.css".

    Code HTML4Strict:
    <link type="text/css" href="CSS/style.css">
    I'm telling to the server that from the folder it is, he needs to go one down, inside the CSS folder, to get the file.

    I also have a gallery.html that I kept separate from the rest, in the IMAGES subfolder, and I have some styling for that too, names "gallery_sytle.css" but that css file is under the CSS subfolder.

    Paths are always relative from the file you're working with (in this case, from gallery.html). Therefore, if gallery.html is under IMAGES, I need to go up one folder to get to the "main" folder, and then go down to CSS folder to get the file.

    Code HTML4Strict:
    <link type="text/css" href="../CSS/style.css">

    So "../" means go up one folder and "name_folder/" means look into this subfolder.

    I hope this is clear and help you to understand why your links don't work.

  6. #6
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    TMAK, there are no system settings which would block links from working, if they are relatively linked to the right path then it will work, you are probably not linking to the right location (which is causing the file not found error).

  7. #7
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reference code was from the book WEB SITE THE RIGHT WAY, anyway it,s sorted now, it looks like it was a box in the folders file that was ticked and should have been, i think.

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The document placed in the same folder and use relative links.

  9. #9
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the same problem. I started yesterday with the same book, made 3 page: index.html, about.html, contact.html, put them in the same folder, they look good then copied and pasted the 'link thingies' exactly where the book said they should be but the links don't work!
    What have I done wrong?

  10. #10
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't bother replying, I've sorted it out after 3 hours. It was my lack of knowledge of 'ze inglish language' which was the problem. Sorry.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •