0

I am working on a website and I am having an issue with relative links back to the index.html and to the CSS sheet. I am currently visiting a file, named blog.html which is inside the sites directory. The index.html is in the root folder. The CSS is called main.css and is located in a special css folder, on root level.

I have used this code for the navigation:

<nav>
    <ul>
        <li><a href="../index.html">HOME</a></li>
        <li class="selected"><a href="blog.html">BLOG</a></li>
        <li><a href="">INVENTIONS</a></li>
        <li><a href="">RECIPES</a></li>
        <li><a href="">LOCATIONS</a></li>
    </ul>
</nav>

However, after saving and refreshing the page, it will still just link to /sites/index.php instead of just index.php.

I have tried using just a / as well as ./ it won't work. The CSS sheet is the same error. It seems to be looking in sites/css/ for main.css instead of /css/main.css.

I am already using relative links and I know that ../index.html should link back to (root)/index.html from sites/blog.html. It is not working though. The link remains inside the sites/ directory and does not move back up to root.

Any idea why this is happening? Never had this issue before.

BenjB
  • 155
  • 9
  • What is the exact URL this page is being served on? – MTCoster Jan 13 '19 at 01:35
  • It is not yet online. It is just running on my office computer right now. A Linux machine. It is inside the home/buske-it/projects/project-name/ folder. I have uploaded a version of it onto a subdomain I use as a testing environment, but I have not yet uploaded these changes, since I did not manage to get them to work. – BenjB Jan 13 '19 at 01:36
  • Okay, I worded my question poorly. What is the URL entered into your browser to access this page? – MTCoster Jan 13 '19 at 01:37
  • file:///home/buske-it/webdesign/projects/project-name/index.html is the main site. The link from there to projects/project-name/sites/blog.html works fine. However the link back to projects/project-name/index.html is not working. EDIT - Basically, the index.html is just one directory above, in root. I am in sites/ – BenjB Jan 13 '19 at 01:39
  • Possible duplicate of [Links not going back a directory?](https://stackoverflow.com/questions/4862231/links-not-going-back-a-directory) – MTCoster Jan 13 '19 at 01:42
  • I don't think so. I am using the relative links, which are mentioned in this post and have been accepted as an answer. The relative links are not working though. I know that ../index.html should link me back from sites/blog.html to /index.html... however it does not. – BenjB Jan 13 '19 at 01:46

1 Answers1

0

So, I have found a solution or rather I followed some troubleshooting steps, that did it.

  1. cleared browser cache again.
  2. I deleted the html file and then saved it again. I am using Sublime, so the content remained, even after the file had become deleted.
  3. I did refresh the site

And out of the sudden all was working. Strange still, never had that happen before. Either way, it is now working.

BenjB
  • 155
  • 9