non-existent HTML suffix

C

cous

Looking in the address bar I'll see pages within a site without the
HTML suffix, e.g. www.site.com/archive whereas other sites (usually
less professionally designed ones) will have www.site.com/archive.html.
How is this achived? Do the pages not have the HTML suffix on the
server? Confused. Would be grateful for some enlightenment. Thanks.
 
A

Andy Dingley

Looking in the address bar I'll see pages within a site without the
HTML suffix, e.g. www.site.com/archive whereas other sites (usually
less professionally designed ones) will have www.site.com/archive.html

It's not about a missing "suffix", it's about specifying a directory
in the URL rather than a page (i.e. the whole filename is missing).
The web server can be configured (and usually already is) to serve an
"index page" for each directory, if one exists. These index pages are
named "index.htm" or "index.html" (on most web servers) or sometimes
"default.htm" on Windows / IIS.

Try uploading a page called index.htm to your web hosting, then seeing
if the server now responds to a URL for that directory.

If you need to change the config, use Apache as a web server and look
up details of the .htaccess file.
 
C

cous

It's not about a missing "suffix", it's about specifying a directory
in the URL rather than a page (i.e. the whole filename is missing).

I see. So, for example, if I had a gallery page I would put another
index.html within a gallery folder on the server and it would be
www.site.com/gallery but then if I had to have more than one gallery
html file I would need need to have www.site.com/gallery2.html unless
I created a folder (directory) for each html file. Or am I totally
mistaken. Sorry, a bit of a newbie with all this.
 
T

Toby A Inkster

Andy said:
It's not about a missing "suffix", it's about specifying a directory in
the URL rather than a page (i.e. the whole filename is missing).

That's not necessarily true. Consider for example:

http://examples.tobyinkster.co.uk/hcard

It's certainly not a directory -- it's an actual file on my server called
"hcard".

Cous, URLs on the web don't need to have any "suffix". Unlike Windows,
which relies on the last few letters of the filename to figure out what
type of file it is (e.g. ".jpeg" is a JPEG image; ".txt" is a text file,
etc), the Web uses a feature of the HTTP protocol called the Content-Type
header. As long as that Content-Type header specifies the correct type of
file (that is "text/html" for an HTML file), it doesn't matter what the
page's URL is -- it certainly doesn't need to be called "something.html".

What gets some people confused about the matter is that some web *server*
software (most, in fact) in the absence of any other information, by
default, uses the file name's suffix to determine which Content-Type to
tell the browser. But you don't need to rely on this default behaviour.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 42 days, 22:30.]
[Now Playing: Jackson 5 - I Want You Back]

The Semantic Web
http://tobyinkster.co.uk/blog/2008/03/09/sw/
 
A

Andy Dingley

That's not necessarily true.

Of course not, but it is true in the circumstance the OP is asking
about. Don't confuse him any more than we have to, just yet!
 
J

Jukka K. Korpela

Scripsit Toby A Inkster:
That's not necessarily true.

Technically, it's never true: URLs do not specify directories. A URL has
a path part, and servers may handle them as they like. Conceptually, a
server need not even have any file system. In practice, they usually map
path parts to path names of files, and in _that_ sense, some parts of a
URL may correspond to directories.
Consider for example:

http://examples.tobyinkster.co.uk/hcard

It's certainly not a directory -- it's an actual file on my server
called "hcard".

Another example:

http://www.cs.tut.fi/~jkorpela/css-caveats

You cannot tell what the file name (if any) is, unless I decide to
reveal it. It happens to be css-caveats.html but it could be just
anything.
 
C

cous

You cannot tell what the file name (if any) is, unless I decide to
reveal it. It happens to be css-caveats.html but it could be just
anything.

One issue I have is with Server Includes...I've tried using a Server
Include without, for example, a HTMLS suffix and it doesn't work,
although it *does* with it in place. So how do I use Server Includes
and *not* use a 3 letter suffix on the file...so can I have www.site.com/gallery
and have a an include within the code of that page. Thanks for all the
help so far; it's been very educational.
 
B

Bergamot

Andy said:
Of course not, but it is true in the circumstance the OP is asking
about.

I didn't read it that way. The example he posted did not have a slash at
the end of "index", so I took it as a file without an extension, not a
directory.
 
D

dorayme

<[email protected]
,

I see. So, for example, if I had a gallery page I would put another
index.html within a gallery folder on the server


Let's stop here for a moment and say what may or may not be
obvious to you. You don't *need* to put any such thing. If it is
important to you that visitors are given... mysite/gallery/
instead of something like ... mysite/gallery/landscapes.html then
you need to make an html page and call it as you have been
advised by others. You would not have landscapes.html but
index.html for its name. But you can have landscapes.html and
simply let people know the address to it.

If you do not have an index file inside a directory and you do
not give folk a url to a specific html file within that
directory, at least one of two things will happen if the visitor
simply goes to a url of a directory, namely ...mysite/gallery/

(1) A web server page listing the files and folders in that
directory. For example:

<http://people.aapt.net.au/~miltonreid/landscapes/>


or

(2) A notice from the webserver that you are denied even to look
at the contents of the folder. For example:

<http://www.users.bigpond.net.au/tvrs/includes/>

(in this case, precisely because there is no file called
specifically index.html etc).
 
J

Jeff

Bergamot said:
I didn't read it that way. The example he posted did not have a slash at
the end of "index", so I took it as a file without an extension, not a
directory.


If it has the trailing slash it's definitely a directory. If it
doesn't it may be a file, and that should be checked first, then it
looks for the various index possibilities.

A few years ago, leaving off the trailing slash was quite a topic of
discussion. It's wrong, of course, but practically it makes little
difference. Put it your html, because it's saves a check, but leave it
out of your printed stock, because the server will figure it out.

Jeff
 
J

Jonathan N. Little

dorayme said:
Let's stop here for a moment and say what may or may not be
obvious to you. You don't *need* to put any such thing. If it is
important to you that visitors are given... mysite/gallery/
instead of something like ... mysite/gallery/landscapes.html then
you need to make an html page and call it as you have been
advised by others. You would not have landscapes.html but
index.html for its name. But you can have landscapes.html and
simply let people know the address to it.

If you do not have an index file inside a directory and you do
not give folk a url to a specific html file within that
directory, at least one of two things will happen if the visitor
simply goes to a url of a directory, namely ...mysite/gallery/

(1) A web server page listing the files and folders in that
directory. For example:

<http://people.aapt.net.au/~miltonreid/landscapes/>


or

(2) A notice from the webserver that you are denied even to look
at the contents of the folder. For example:

<http://www.users.bigpond.net.au/tvrs/includes/>

(in this case, precisely because there is no file called
specifically index.html etc).

Yes but the point some folks have been correctly making is that URL may
or may not be analogous to directory structure.

www.example.com/foo/bar/bam

'foo' may or may *not* be a directory
'bar' may or may *not* be a directory
'bam' may or may *not* be a a file

not index file involved, they may all be parameters directed to a
database...
 
J

Jonathan N. Little

Jeff said:
If it has the trailing slash it's definitely a directory. If it doesn't
it may be a file, and that should be checked first, then it looks for
the various index possibilities.

Actually that is not true.

http://www.littleworksstudio.com/Amberlithe/articles/

Is "articles" a directory on one of my sites? If you say yes you are
wrong, there is not folder named "articles" and that is not a folder at all.

URL != Files System
 
J

Jeff

Jonathan said:
Actually that is not true.

http://www.littleworksstudio.com/Amberlithe/articles/

Is "articles" a directory on one of my sites? If you say yes you are
wrong, there is not folder named "articles" and that is not a folder at
all.

URL != Files System

You can rewrite anything to anything. But in your case it's:

http://www.littleworksstudio.com/Amberlithe/articles/index.html

Isn't that one of the various index possibilities? Now whether, you
mod rewrote that from something else I don't know for sure. Query
strings commonly get rewritten to look like directories (for SEO), but
I'm thinking you probably did not do that here. Certainly we weren't
talking about rewriting URLs.

Jeff
 
D

dorayme

"Jonathan N. Little said:
dorayme said:
Let's stop here for a moment and say what may or may not be
obvious to you. You don't *need* to put any such thing. If it
[...]

(1) A web server page listing the files and folders in that
directory. For example:

<http://people.aapt.net.au/~miltonreid/landscapes/>


or

(2) A notice from the webserver that you are denied even to look
at the contents of the folder. For example:

<http://www.users.bigpond.net.au/tvrs/includes/>

(in this case, precisely because there is no file called
specifically index.html etc).

Yes but the point some folks have been correctly making is that URL may
or may not be analogous to directory structure.

www.example.com/foo/bar/bam

'foo' may or may *not* be a directory
'bar' may or may *not* be a directory
'bam' may or may *not* be a a file

not index file involved, they may all be parameters directed to a
database...

I was trying to go back and not blind the OP with science, trying
to give the ordinary practical things OP might want, to help him.
Imagining what he probably is dealing with on his server.

Tell me something Jonathan, did the OP to you seem to be the sort
of person that would benefit from this display of geek, these
subtleties?

(I have sent men to grab bits of your brain for myself. I at
least will appreciate it. Please don't try to resist. I don't
want anything damaged when it arrives).
 
J

Jonathan N. Little

dorayme said:
I was trying to go back and not blind the OP with science, trying
to give the ordinary practical things OP might want, to help him.
Imagining what he probably is dealing with on his server.

Tell me something Jonathan, did the OP to you seem to be the sort
of person that would benefit from this display of geek, these
subtleties?

Except that it is a fundamental aspect of websites. URL != Files System
Something you must get a handle on early, else you get stuff like

<img href="C:\Document and Settings\Bozo\Desktop\Website\My.jpg" ...

If you want to build a house it helps to know the difference between a
hammer and a screw driver...
 
J

Jonathan N. Little

Jeff said:
You can rewrite anything to anything. But in your case it's:

http://www.littleworksstudio.com/Amberlithe/articles/index.html

Isn't that one of the various index possibilities?

No it is *not!* There us no articles folder nor any "index.*" in any
subdirectory of "Amberlithe"
Now whether, you
mod rewrote that from something else I don't know for sure. Query
strings commonly get rewritten to look like directories (for SEO), but
I'm thinking you probably did not do that here. Certainly we weren't
talking about rewriting URLs.

Could be a symbolic link, not necessarily a rewrite, but what does it
matter, a URL is a URL. But again I say: URL != File System
 
D

dorayme

If you want to build a house it helps to know the difference between a
hammer and a screw driver...

But not the difference between a not so fine toothed saw and a
fine toothed one for the sort of houses I build or renovate. I
don't believe in such fine living. <g>

Still, I take your larger point.
 
C

cous

This is the OP again and I'm clearer on a lot of things. I realize
that I can easily put www.site.com/gallery.html it was only that on
more and more sites I seem to visit lately I see the HTML missing. So
I see www.site.com/gallery (without a finishing /) .
So this then means there is the index page within this directory...but
also it's not essential to use a suffix for a page? Because there is
often more than one page within a directory.

Also, no one really brought up my issue with Server Includes which I
include again here...

I've tried using a Server Include without, for example, a HTMLS suffix
and it doesn't work,
although it *does* with it in place. So how do I use Server Includes
and *not* use a 3 letter suffix on the file?

Thanks again for all the useful advice.
 
D

dorayme

<[email protected]
cous said:
This is the OP again and I'm clearer on a lot of things. I realize
that I can easily put www.site.com/gallery.html it was only that on
more and more sites I seem to visit lately I see the HTML missing. So
I see www.site.com/gallery (without a finishing /) .
So this then means there is the index page within this directory...

It means this if the url is to be successful (unlike in one of
the earlier urls I gave you to demonstrate where there is no such
file)
 
J

Jonathan N. Little

cous said:
Also, no one really brought up my issue with Server Includes which I
include again here...

I've tried using a Server Include without, for example, a HTMLS suffix
and it doesn't work,
although it *does* with it in place. So how do I use Server Includes
and *not* use a 3 letter suffix on the file?

Depends on how the server is setup, if allow in .htaccess you can change
it with AddHandler or ever set it for a certain folder like cgi-bin is
normally for CGI...

Just most servers use the .shtml extension to clue the server that
server side include processing is required.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top