Forum Moderators: phranque
This happens locally and also on the server.
For example for the home page the link to the SSI file is
navgation-left.ssi and when I put the page into a subdirectory the link might be
../navgation-left.ssi This all looks fine to me, but clearly I am missing something.
I am only putting the html page down one level of directory. Surely the double dots points the link back at the root directory where the SSI file is?
I am not on Apache (Windows IIS), so the virtual option doesn't seem to work either.
So, if the html page and the ssi file are in the same root directory I have been using <!--#include file="nameofile.ssi" -->
Then I put another page one directory level down, but keep the ssi file in the root directory, shouldn't it become <!--#include file="../nameofile.ssi" -->
I have been using <!--#include file="nameofile.ssi" -->
See coopster's previous post - the "rule of thumb" with SSI is if it's in the same directory, use file, if it's in a different directory, use virtual..
<!--#include virtual="/nameofile.ssi" -->
<!--#include virtual="/dir/nameofile.ssi" -->
The "dot syntax" will always get you in trouble, or at least confused. Do the same within your SSI files:
/images/some-image.jpg
Never
../../some-image.jpg
(An ailment similar to Larry Wall's "toothpick syndrome")
Then I put another page one directory level down, but keep the ssi file in the root directory, shouldn't it become <!--#include file="../nameofile.ssi" -->
It could, but if you use the previous advice and do
/nameofile.ssi
you can move it anywhere.
Adapting this habit will allow you to move your files anywhere on your system and they will always connect, you won't even have to look. :-)