I think some of the confusion is from the old CERN based HTTP server
(remember that? lol).

It didn't really have a DocumentRoot (in the Apache form) and IIR if you
didn't specify a link with a forward slash it would use the "current"
directory of the URI (such as /cgi-bin if you're running a CGI program).

Similar to how directories work with WRKLNK and other IFS type commands,
etc... if you don't use a forward slash, it tacks on the "current
directory". Which means being consistent and never changing the current
directory things will work, but if that does change and you're not
specifying the fully qualified path, then problems and confusion start.

The use of a forward slash (qualified path) just followed through for some
(including me) to the Apache server. I only prefer the forward slash
because it's how I've always done it, and it's never caused me an issue,
even with multiple environments. And I've put together many thousand sites
for myself and many others over the years.

As long as I set up my paths/directories the same for each environment, it
works (and "should" work with a virtual path as well with the Apache
server).

But I HATE seeing things like .../../..//../../main.css in HTML files..
(yes, that's exaggerated).. haha..

Brad
www.bvstools.com


On Thu, Jan 17, 2013 at 5:02 PM, Kevin Turner
<kevin.turner@xxxxxxxxxxxxxxx>wrote:

Robert

I have never used a base tag, but I still use relative links in
dynamically generated HTML. Works just fine.

Rgds
Kevin

Sent from my iPad

On 17 Jan 2013, at 22:57, "Dean, Robert" <rdean@xxxxxxxxxxxx> wrote:

The browser would only do that if you reset the document base using the
<base> tag. I should have thought of that earlier, because it's (IMO) the
more correct solution to the original problem. However, it's been a while
since I've written a cgi-bin script that produces HTML. ;-)

Example
<head>
<base href="http://my.domain.name/"; />
</head>

________________________________________
From: web400-bounces@xxxxxxxxxxxx [web400-bounces@xxxxxxxxxxxx] on
behalf of Kevin Turner [kevin.turner@xxxxxxxxxxxxxxx]
Sent: Thursday, January 17, 2013 5:30 PM
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] CSS file not being found

Vern

It depends on the directives, but normally HTML delivered from a CGI
program (for example) are deemed to be in the document root. So HTML
delivered that way can reference static resources relative to the document
root (without a preceding '/').

It works like that for me anyway :) I never use absolute paths in my
apps. Not sure why, or what is better or worse really. I am sure there
are arguments to be had either way.

Rgds
Kevin

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Vernon Hamberg
Sent: 17 January 2013 22:26
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] CSS file not being found

Kevin

I've generally used absolute paths, so it'd help me to know how the
current folder is determined - I thought it was the folder where the active
HTML file is located.

Now if that's true - it's fine for static pages. But dynamic pages are
not located anywhere. So what is the current folder then? Is it the
document root?

I was just looking up some of this but did not get an answer quickly. I
do remember reading about it once upon a time - along with other fairy
tales, eh?

Vern

On 1/17/2013 4:20 PM, Kevin Turner wrote:
Steve

You should not have to put a '/' in front of the file name to make it
work. That just makes it an absolute path. It should would without '/' as
long as the file you are looking for it relative to the current folder.

For example:
/foo/bar/kevin.css
This translates to:
http://www.example.com/foo/bar/kevin.css

But without the slash, it becomes a relative reference rather than
absolute:
foo/bar/kevin.css
tells the server to look in the current folder (not the root folder)
for the directory "foo" and then drill down to "bar" for kevin.css.
../foo/bar/kevin.css
tells the server to go back one folder from the current folder, then
look in directory "foo" and then drill down to "bar" for kevin.css.

So if it doesn't work without a '/', it just means that you are not
referencing it properly, relative to the current folder (i.e. the folder in
which the HTML file resides that is requesting it).

In other words, if I have a directory structure like this:
myserver
-->htdocs
---->css

If my html file is in myserver/htdocs and my css file (called
steve.css) is in myserver/htdocs/css Then my html can reference the
css like this (without a '/' at the start) href="css/steve.css"

If steve.css is in the same place as the html (i.e in myserver/htdocs)
then it can be referenced like this:
href="steve.css"

Clear as mud!
Kevin

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Steve Richter
Sent: 17 January 2013 21:54
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] CSS file not being found

On Thu, Jan 17, 2013 at 4:47 PM, Kevin Turner <
kevin.turner@xxxxxxxxxxxxxxx> wrote:
That is what I said in my first reply Steve! :)
I see that now.. Smacks head.

Now that it is working I see that it does not work without the / in
front of the .css file name:

<link rel="stylesheet" href="/steve.css" /> <!-- works -->
<link rel="stylesheet" href="steve.css" /> <!-- does not work -->

The <directory> directives are mainly for you to dictate permissions
to various locations in the document root. You can refer to anything
in a <directory> directive, but if the directory does not exist, it just
gets ignored.
got it.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.


NOTICE: The information in this electronic mail transmission is
intended by CoralTree Systems Ltd for the use of the named individuals or
entity to which it is directed and may contain information that is
privileged or otherwise confidential. If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone, so that the sender's address records can be corrected.



----------------------------------------------------------------------
----------


CoralTree Systems Limited
25 Barnes Wallis Road
Segensworth East, Fareham
PO15 5TT

Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton, UK
SO15 2EA
VAT Registration Number 834 1020 74.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.


NOTICE: The information in this electronic mail transmission is intended
by CoralTree Systems Ltd for the use of the named individuals or entity to
which it is directed and may contain information that is privileged or
otherwise confidential. If you have received this electronic mail
transmission in error, please delete it from your system without copying or
forwarding it, and notify the sender of the error by reply email or by
telephone, so that the sender's address records can be corrected.




--------------------------------------------------------------------------------


CoralTree Systems Limited
25 Barnes Wallis Road
Segensworth East, Fareham
PO15 5TT

Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton, UK
SO15 2EA
VAT Registration Number 834 1020 74.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


NOTICE: The information in this electronic mail transmission is intended
by CoralTree Systems Ltd for the use of the named individuals or entity to
which it is directed and may contain information that is privileged or
otherwise confidential. If you have received this electronic mail
transmission in error, please delete it from your system without copying or
forwarding it, and notify the sender of the error by reply email or by
telephone, so that the sender's address records can be corrected.




--------------------------------------------------------------------------------


CoralTree Systems Limited
25 Barnes Wallis Road
Segensworth East, Fareham
PO15 5TT

Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton, UK
SO15 2EA
VAT Registration Number 834 1020 74.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.