Forum Moderators: phranque
Here goes... :)
I have a site running on an Apache 1.33 server, and am using a SSI to include the main navigation. My include looks like this...
<!--#include virtual="/nav.htm"-->
The HTML looks like this in 'nav.htm'...
<ul id="topnav">
<li><a href="/about/index.htm" class="p7PMtrg">About</a>
<ul>
<li><a href="/about_harker/index.htm">Overview</a></li>
<li><a href="/" class="p7PMtrg">Our Campuses</a>
<ul>
<li><a href="/about_harker/index.htm">Lower School</a></li>
<li><a href="/about_harker/welcome.htm">Middle School</a></li>
<li><a href="/about_harker/philosophy.htm">Upper School</a></li>
</ul>
</li>
<li><a href="/about/welcome.htm">Welcome</a></li>
<li><a href="/about/philosophy.htm">Philosophy</a></li>
<li><a href="/history/index.htm">History</a></li>
<li><a href="/achievements/index.htm">Achievements</a></li>
<li><a href="/about/careers.htm">Careers</a></li>
<li><a href="/media/index.htm">Media</a></li>
</ul>
</li>
</ul>
The problem lies in the links themselves, I think... Somehow when you get to the subpages the links in 'nav.htm' become relative to the directory they are in. So if I cruise to the page "about/index.htm" the nav menu links to the rest of the site now start with "about/" as the root folder instead of "/". How can I fix this?
Try specifying a canonical URL (http://www.example.com/campus.html) for one of those pages, then re-test and see if anything changes.
If this is new code, be sure you flush your browser cache before testing any changes.
If neither of these helps, then do a view-page source in your browser. Since it is the browser that resolves all non-canonical links, you should see the problem in the browser's copy of the code.
Jim
Jim
Not as they should...
../about
I am not sure why they would - they are in the file as a server relative path (/about/file.html) that is exactly how they will be displayed - Includes of html just consolidate code so you can change many places from a single file, they do not change what is in that file based on file location.
They work when you put the full canonical path, because you have the full external path to the file, so the server knows where to look for it.
Justin
Should it be noted that 'nav.htm' IS in the root folder of the site. http://www.example.com/nav.htm...
[edited by: jatar_k at 6:49 pm (utc) on Aug. 31, 2005]
[edit reason] examplified [/edit]