By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,224 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,224 IT Pros & Developers. It's quick & easy.

[Q] SSIs for Navigation Bars & Subdirectories

P: n/a
Goal:
Have a (nearly) equivalent website on a local machine (running MacOSX)
to what exists on the web host
Problem:
I have a file call navigation_bar.txt which is included (via SSI-
#include virtual=) in every web page. References in navigation_bar.txt
that work on the web host, like

<a href="/subdir/index.shtml">

do not work on the machine when the page is hosted from a user account.
On the webhost, the DocumentRoot points to the directory that the root
index.shtml file is in. On the local machine, the DocumentRoot points to
the default location (/Library/Webserver/Documents) and the files for
the website are in ~/Sites/RootDir.

I believe the source of my problem on the local machine is that
DocumentRoot would need to point to /Users/username/Sites/RootDir

But, then I think about all of the various shareware website projects
which probably cannot assume anything about where DocumentRoot points
and still likely do something similar with navigation bars. So, I wonder
how they solved the problem. I went hunting around for such a project,
but nothing popped up right away.
Any comments?

Note: I have found one possible solution, which is to define a
VirtualHost and then have DocumentRoot point to where I would need it to
point, but I would like to develop the site in such a way that it is not
dependent upon where DocumentRoot points, like so many web applications
which are capable of sitting entirely within a subdirectory of
DocumentRoot.
(hopefully this was clear...if it was not, I can certainly answer any
clarification questions.)

thank you.
Jul 24 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Tim
On Wed, 06 Apr 2005 04:51:42 GMT,
eg******@verizon.net (Eric) posted:
I have a file call navigation_bar.txt which is included (via SSI-
#include virtual=) in every web page. References in navigation_bar.txt
that work on the web host, like

<a href="/subdir/index.shtml">

do not work on the machine when the page is hosted from a user account.
On the webhost, the DocumentRoot points to the directory that the root
index.shtml file is in. On the local machine, the DocumentRoot points to
the default location (/Library/Webserver/Documents) and the files for
the website are in ~/Sites/RootDir.

I believe the source of my problem on the local machine is that
DocumentRoot would need to point to /Users/username/Sites/RootDir


See if you can use relative addresses for the includes. It *may* be one
simple solution to that problem.

Otherwise, I'd implement the local copy in an identical fashion to the
remote one.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 24 '05 #2

P: n/a
Tim <ti*@mail.localhost.invalid> wrote:
On Wed, 06 Apr 2005 04:51:42 GMT,
eg******@verizon.net (Eric) posted:
I have a file call navigation_bar.txt which is included (via SSI-
#include virtual=) in every web page. References in navigation_bar.txt
that work on the web host, like

<a href="/subdir/index.shtml">

do not work on the machine when the page is hosted from a user account.
On the webhost, the DocumentRoot points to the directory that the root
index.shtml file is in. On the local machine, the DocumentRoot points to
the default location (/Library/Webserver/Documents) and the files for
the website are in ~/Sites/RootDir.

I believe the source of my problem on the local machine is that
DocumentRoot would need to point to /Users/username/Sites/RootDir

First, I suppose I should have stated the goal as being:

Have a (nearly) equivalent website on a local machine to what exists on
the web host and not be dependent upon DocumentRoot.
See if you can use relative addresses for the includes. It *may* be one
simple solution to that problem.
Since navigation.txt in SSI included in every page, this would only work
for pages sitting at DocumentRoot, not for for pages sitting in a
subdirectory of DocumentRoot.
Otherwise, I'd implement the local copy in an identical fashion to the
remote one.


So, what you are saying is that other web projects do one of the
following:

Assume they either:

(1) start at DocumentRoot

(2) start in a subdirectory of DocumentRoot

(3) require the person installing to specify where they are
in relation to DocumentRoot through the use of SSI user variables

Jul 24 '05 #3

P: n/a
Eric wrote:
Goal:
Have a (nearly) equivalent website on a local machine (running MacOSX)
to what exists on the web host
What is different?
Problem:
I have a file call navigation_bar.txt which is included (via SSI-
#include virtual=) in every web page. References in navigation_bar.txt
that work on the web host, like
<a href="/subdir/index.shtml">
do not work on the machine when the page is hosted from a user account.
Are SSIs enabled on the local account?
On the webhost, the DocumentRoot points to the directory that the root
index.shtml file is in. On the local machine, the DocumentRoot points to
the default location (/Library/Webserver/Documents) and the files for
the website are in ~/Sites/RootDir.

The include file path is relative to DocumentRoot. If the files are in
a different place, of course it does not work. Put the .shtml files in the
DocumentRoot of the local machine.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 24 '05 #4

P: n/a
In article <Vc********************@giganews.com>,
Jim Moe <jm***************@sohnen-moe.com> wrote:
Eric wrote:
Goal:
Have a (nearly) equivalent website on a local machine (running MacOSX)
to what exists on the web host


I have a heavily SSI dependent site mirrored on my MacOSX machine with
no problem, but I did have enable SSI's by editing the config file
("/etc/httpd/httpd.conf") on the local server (i.e. my machine). Check
the Apache manual or Google to see what you have to change.

Denny Straussfogel
Jul 24 '05 #5

P: n/a
Jim Moe <jm***************@sohnen-moe.com> wrote:
On the webhost, the DocumentRoot points to the directory that the root
index.shtml file is in. On the local machine, the DocumentRoot points to
the default location (/Library/Webserver/Documents) and the files for
the website are in ~/Sites/RootDir.

The include file path is relative to DocumentRoot. If the files are in
a different place, of course it does not work. Put the .shtml files in the
DocumentRoot of the local machine.


I would like to develop a portable site - one that is not dependent upon
where it located relative to DocumentRoot.

So, I am attempting to decern how other web projects have solved this
problem.

I believe they must assume the project either:

(1) starts at DocumentRoot

(2) starts in a subdirectory of DocumentRoot

(3) requires the person installing to specify where they are
in relation to DocumentRoot through the use of SSI user variables

(4) uses server wide variables like PATH_INFO, etc. to accomplish
the same thing as #3.

Comments?


Jul 24 '05 #6

P: n/a
Eric wrote:
So, I am attempting to decern how other web projects have solved this
problem.

I believe they must assume the project either:
(1) starts at DocumentRoot
(2) starts in a subdirectory of DocumentRoot

The Apache httpd docs <http://httpd.apache.org/docs/howto/ssi.html>
indicate 1 and 2 are how it's done.
--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 24 '05 #7

P: n/a
Tim
eg******@verizon.net (Eric) posted:
First, I suppose I should have stated the goal as being:

Have a (nearly) equivalent website on a local machine to what exists on
the web host and not be dependent upon DocumentRoot.
Tim wrote:
See if you can use relative addresses for the includes. It *may* be one
simple solution to that problem. Since navigation.txt in SSI included in every page, this would only work
for pages sitting at DocumentRoot, not for for pages sitting in a
subdirectory of DocumentRoot.


Rather depends on what you're inserting where. e.g. My own server inserts
navigation menus for each sub-section, they're all in their own directory,
and they use the local nav file for the insert.
Otherwise, I'd implement the local copy in an identical fashion to the
remote one.


(Since you can control the local server as much as you're able to, and
that's probably more than your able to modify the remote one.)

How you do this depends on what you're replicating.

In my case, I make website for other people with their own domain names. I
make a virtual host on my machine for each one, and they all run
independently as if they have their own server (they each have their own
document root). I use absolute addresses within them all.

If these sites were all subdirectories off one domain, then I'd do the same
thing with my local server (mirror it). I might do this as a virtual host
in itself, that way my web server can be more than just a mirror for the
one site.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 24 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.