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.

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.