• Can #include virtual start with a slash ?

    From Gentsquash@21:1/5 to All on Wed Jun 8 05:29:13 2022
    The server on my home computer points

    "http://localhost/~squash/"

    to "~/Sites/" where all my .html and .shtml files reside.

    Every .html file has

    <BASE HREF="http://localhost/~squash/">

    in the header

    Under "~/Sites/" is a subdirectory "~/Sites/Include/"
    intended for statements such as

    <!--#include virtual="Include/file.shtml" -->


    Is it legal, and does it mean anything, to have an initial
    slash, i.e

    <!--#include virtual="/Include/file.shtml" -->

    If the is latter is legal, what does it mean relative to
    the former? -Thank you, all.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phillip Helbig (undress to reply@21:1/5 to Gentsquash on Wed Jun 8 13:41:36 2022
    In article <414e193e-b966-4c69-bd84-9cb2cec04764n@googlegroups.com>,
    Gentsquash <gentsquash@gmail.com> writes:

    The server on my home computer points

    "http://localhost/~squash/"

    to "~/Sites/" where all my .html and .shtml files reside.

    Every .html file has

    <BASE HREF="http://localhost/~squash/">

    in the header

    Under "~/Sites/" is a subdirectory "~/Sites/Include/"
    intended for statements such as

    <!--#include virtual="Include/file.shtml" -->


    Is it legal, and does it mean anything, to have an initial
    slash, i.e

    <!--#include virtual="/Include/file.shtml" -->

    If the is latter is legal, what does it mean relative to
    the former? -Thank you, all.

    Do both work for ALL the browsers you've tried?

    Try inserting two slashes instead of one in some URL. Does it still
    work?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Gentsquash on Wed Jun 8 09:22:10 2022
    On 6/8/22 6:29 AM, Gentsquash wrote:
    Under "~/Sites/" is a subdirectory "~/Sites/Include/" intended for
    statements such as

    <!--#include virtual="Include/file.shtml" -->

    I assume that you're talking about Server Side Include (a.k.a. SSI).

    Is it legal, and does it mean anything, to have an initial slash, i.e

    <!--#include virtual="/Include/file.shtml" -->

    Yes and yes.

    If the is latter is legal, what does it mean relative to the former?

    The leading slash means that the included file is relative to Document_Root.

    The lack of leading slash means that the included file is relative to
    the directory the file doing the include is in.

    -Thank you, all.

    You're welcome.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gentsquash@21:1/5 to Grant Taylor on Wed Jun 8 09:21:01 2022
    On Wednesday, June 8, 2022 at 11:21:57 AM UTC-4, Grant Taylor wrote:
    On 6/8/22 6:29 AM, Gentsquash wrote:

    Under "~/Sites/" is a subdirectory "~/Sites/Include/" intended for statements such as

    <!--#include virtual="Include/file.shtml" -->

    I assume that you're talking about Server Side Include (a.k.a. SSI).

    Thank you, Grant. Yes, I meant Server Side Include [it's
    been about 15 years since I studied html, and I have
    forgotten everything ... until I recently moved files, and
    broke stuff.]

    Is it legal, and does it mean anything, to have an initial slash, i.e

    <!--#include virtual="/Include/file.shtml" -->

    ...

    The leading slash means that the included file is relative to Document_Root.

    The lack of leading slash means that the included file is relative to
    the directory the file doing the include is in.

    Ah. I thought that

    <!--#include virtual="Include/file.shtml" -->

    was relative to the

    <BASE HREF="http://localhost/~squash/">



    Grant are you saying this:

    In file

    ~/Sites/A/B/C/Grant.html

    suppose I have

    <BASE HREF="http://localhost/~squash/">

    Does

    <!--#include virtual="Include/file.shtml" -->

    search for a file called

    ~/Sites/A/B/C/Include/file.html

    whereas (putting in a leading-slash)

    <!--#include virtual="/Include/file.shtml" -->

    searches for

    ~/Sites/Include/file.html

    ?

    Thanks again for your help, Grant. --Jonathan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Wed Jun 8 19:17:52 2022
    Gentsquash:

    [...]
    Ah. I thought that

    <!--#include virtual="Include/file.shtml" -->

    was relative to the

    <BASE HREF="http://localhost/~squash/">

    No. The latter one is just HTML to tell the browser which URL should be
    used a base for *relative* URLs:

    <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base>

    This has nothing to do with <!--#include virtual="..." --> which runs on
    the *server* and will get executed the to include a file on the *server*
    before the content will be sent to the browser.

    Grant are you saying this:

    In file

    ~/Sites/A/B/C/Grant.html

    suppose I have

    <BASE HREF="http://localhost/~squash/">

    Than this BASE does exactly *nothing* for the include command! The
    include command will always work the same, no matter if you have <BASE>
    nor not - the server won't care.

    Does

    <!--#include virtual="Include/file.shtml" -->

    search for a file called

    ~/Sites/A/B/C/Include/file.html

    whereas (putting in a leading-slash)

    <!--#include virtual="/Include/file.shtml" -->

    searches for

    ~/Sites/Include/file.html

    ?

    Stop thinking in URLs. Only the local file system is relevant.



    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Gentsquash on Wed Jun 8 22:07:50 2022
    On 6/8/22 10:21 AM, Gentsquash wrote:
    Thank you, Grant.

    You're welcome.

    Yes, I meant Server Side Include [it's been about 15 years since I
    studied html, and I have forgotten everything ... until I recently
    moved files, and broke stuff.]

    I get it.

    Ah. I thought that

    <!--#include virtual="Include/file.shtml" -->

    was relative to the

    <BASE HREF="http://localhost/~squash/">

    Nope.

    <!--#include virtual="Include/file.shtml" --> is processed /server/ side.

    <BASE HREF="http://localhost/~squash/"> is processed /client/ side.

    Grant are you saying this:

    I'm going to provide a different example that completely ignores BASE as
    it's unrelated to SSI.

    Assume the following is in the file:

    <!--#include virtual="Include/file.shtml" -->

    If said file is located in $DOCUMENT_ROOT/, then the server will try to
    include the $DOCUMENT_ROOT/Include/file.shtml file.

    If said file is located in $DOCUMENT_ROOT/subdir1/subdirA/, then the
    server will try to include the $DOCUMENT_ROOT/subdir1/subdirA/Include/file.shtml file.

    Conversely if I put the following in the file:

    <!--#include virtual="/Include/file.shtml" -->

    Then the server will always try to include the $DOCUMENT_ROOT/Include/file.shtml file, no matter where I put the file
    that's doing the inclusion.

    $DOCUMENT_ROOT is a setting in the web server that specifies the root of
    the web site. It can be just about anywhere on the file system you want.

    Do a find & replace on $DOCUMENT_ROOT for wherever your web site is
    rooted; e.g. /var/www/vhost/gentsquash/public_html or
    ~gentsquash/public_html. The second is itself dependent on where your
    home directory is located.

    Thanks again for your help, Grant. --Jonathan

    :-)



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Grant Taylor on Wed Jun 8 22:11:40 2022
    On 6/8/22 10:07 PM, Grant Taylor wrote:
    <BASE HREF="http://localhost/~squash/"> is processed /client/ side.

    The <BASE HREF="..."> is used /client/ side by the web browser to
    prepend the location to pull unqualified resources from. E.g.

    <img src="/pictures/selfie.jpg">

    Causes the web browser to prepend the BASE HREF
    (http://localhost/~squash/) to the image source (/pictures/selfie.jpg)
    thus requesting the full URL (http://localhost/~squash//pictures/selfie.jpg)

    Aside: I'm leaving the double slash as it naturally occurs with the two examples.

    Also, the source for the image can be fully pathed (as I've depecited)
    or it can be relative to the page referencing it. Qualification is a
    common theme.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gentsquash@21:1/5 to All on Fri Jun 10 14:53:32 2022
    Thank you, Grant, for the detailed explanation, and also
    thank you Amo for your helpful explanation; I understand
    things better now.
    Cheers, -Jonathan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Gentsquash on Sat Jun 11 00:56:03 2022
    On 6/10/22 3:53 PM, Gentsquash wrote:
    Thank you, Grant, for the detailed explanation,

    You're welcome.

    I understand things better now.

    That was the intention. :-)



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)