Directory Help Needed. Please

I need help with correctly linking to my directory. The rest of the website works fine, but I’ve recently added some new folders and when I click on one of the links to go to another part of the website, it breaks. The page(s) look as they should, but the internal links do not work.

I’ll try to be as clear as possible so please bare with me. Thanks

The file and folders on the main directory are:

index.php
css (folder)
includes (folder)
js (folder)
images (folder)
tutorials (folder)
free (folder)

The page that I am having the problems on is:
http://mywebsite.com/free/logos/download-free-logos.php

When I click on an internal link, it takes to this “Page Not Found” page.
http://mywebsite.com/free/tutorials/tutorials.php

This is the url of a page that works as it should:
http://mywebsite.com/tutorials/tutorials.php

The include file for the navigation links is:
…/…/includes/top-nav.php

Please help.
Thanks

I would change you links to /free/tutorials/tutorials.php as this link is relative to root.

…/ is relative to where you are currently whereas / is from root.

It didn’t work. The file that it should link to is:
mywebsite.com/includes/top-nav.php

The page that I’m issues on is this:
mywebsite.com/free/logos/download-free-logos.php

When I click on a link for example, it takes me here, which is a “Page Not Found” page:
mywebsite.com/free/tutorials/tutorials.php

The include file on the page with the links that don’t work is:
include(“…/…/includes/top-nav.php”);

The page looks fine but the internal links do not work.

Thanks

Specify an URL relative to root for your link:

<a href="/tutorials/tutorials.php">

I tried that and it still doesn’t work.

What are the contents of top-nav.php?

<?php

echo '
<div id="menu-toggle">&#9776;</div>

<ul class="menu">
    <li><a href="http://mywebsite.com/" title="HTML CSS Tutorials">Home</a></li>
    <li>
        <a href="../tutorials/tutorials.php" title="Web Design Tutorials">Tutorials</a>
        <ul>
            <li><a href="../tutorials/html-and-html5-tutorials.php" title="HTML and HTML5 Tutorials">HTML</a></li>
            <li><a href="../tutorials/css-and-css3-tutorials.php" title=CSS and CSS3 Tutorials"">CSS</a></li>
        </ul>
    </li>
    <li><a href="../contact/advertise.php" title="Advertise">Advertise</a></li>
</ul>
     ';

?>

The URLs in your message to the pages that work and don’t work are forwarding to “http://www.1and1.com/website-builder?”. I never go to a page with the URL. Am I having a problem?

Thank you so much! The issue was with the file that contains the navigation links. I’ve created another file for this directory and changed the directory paths and it works now.

Again, thanks everybody and thank you ronpat for having me think about that file.

Wow. Thanks for the feedback. Glad you were able to piece together a fix for the problem.

Sorry, I should have been clear about the url. I just used that url instead of using my actual url. mywebsite.com is not my website.

I am pleased you managed to fix your problem.

If it happens again try this to see exactly where you are and what relative paths are required:

echo '<br />' .getcwd() .'<br />'; die;

echo '<a href="../path-with-problems/tutorials.php"> Web Design Tutorials </a>';

Thanks, I’ll look it up and try it to see how it works.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.