04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How default pages work<br />

5<br />

HTTP response: you asked for a<br />

directory, but I found “index.html”<br />

in that directory, so that’s what<br />

I’m sending back.<br />

Q: So anyone who comes to my site<br />

<strong>with</strong> the URL http://www.mysite.com is<br />

going to see my “index.html” page?<br />

A: Right. Or, possibly “default.htm”<br />

depending on which kind of Web server<br />

your hosting company is using. (Note that<br />

“default.htm” usually has no “l” on the end.<br />

This is a Microsoft Web Server oddity.)<br />

1<br />

The user types<br />

http://www.starbuzzcoffee.com/drinks/<br />

into the browser.<br />

2<br />

HTTP Request: could I please<br />

have the file “/drinks/”?<br />

www.starbuzzcoffee.com<br />

there are no<br />

Dumb Questions<br />

There are other possible default filenames,<br />

like “index.php”, that come into play if you<br />

start writing scripts to generate your pages.<br />

That’s way beyond this book, but that<br />

doesn’t mean you won’t be doing it in the<br />

future.<br />

3<br />

The server says “that<br />

looks like a directory,<br />

is there a default file<br />

in that directory?”<br />

starbuzz<br />

drinks<br />

4<br />

getting connected<br />

Behind<br />

the Scenes<br />

<br />

.<br />

.<br />

.<br />

<br />

index.html<br />

Server locates a<br />

default file called<br />

“index.html” in the<br />

drinks directory.<br />

Q: So when I’m giving someone my<br />

URL, is it better to include the<br />

“index.html” part or not?<br />

A: Not. It’s always better to leave it off.<br />

What if, in the future, you change to another<br />

Web server and it uses another default file<br />

name like “default.htm”? Or you start writing<br />

scripts and use the name “index.php”? Then<br />

the URL you originally gave out would no<br />

longer be valid.<br />

you are here 141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!