Tuesday, April 16, 2024

So, You Don’t Want .html, Huh?

Use these to jump around or read it all…


[The Index Page]

[How To Do It]

[Creating A Directory]

[The Big Hint]


     I’ve gotten lots of letters asking how I am able to post pages that do not require the .html extension. To some it may seem simple enough, but to those new to the HTML game, it isn’t. So, here’s the trick.


     My assumption is that you have a WWW site right now, correct? That means you have a general idea that you need to place files from your computer to a server so the whole world can see them. It’s called FTP-ing a file. Some call it “uploading.”

     When you upload, you are uploading to a directory. That directory is a little section of the server’s hard drive set aside and given a name. Let’s say your home page address is:


http://www.fred.com/~wwwuser

     The name of the directory that you upload or FTP all your files to is “wwwuser.” See that above? Now, what you may not know is that that directory has a certain set of rules that it follows. The main rule is that it allows any- and everyone to look at its contents. It’s a WWW directory and people can access it, right? Another rule is that you are given personal access, with the use of a log-in and password, to place and remove files.


     The rule you may not be aware of, and the one that will be of utmost importance for this little tutorial, is that that directory has been told to look for a specific file name when someone logs in. Look at the address above again: Notice it doesn’t call for any specific page. It could, of course, just by adding a slash and then the page name, like so:


http://www.fred.com/~wwwuser/joe.html

     But that’s not what happened. All that was listed was the name of the directory. Again, look at the original address toward the top. Better yet, look at HTML Goodies or the address at the the top of your browser window. See, the address is:



http://www.htmlgoodies.com/tutors/directory/


     None of these addresses call for a certain page, but one comes up. That’s because of the third rule I spoke of earlier. I hope you were paying attention… and spit out that gum!





The Index Page

     When you got your WWW site, you were told to give the home page a certain name. The vast majority of the time that name is index.html. Why? Because the directory that holds your WWW files has been told that when someone tries to get access to the directory, by default, display the index.html page. Get it?

     Now, don’t get flustered if your default page isn’t index.html. I have been on many different servers. One wanted www.html, the other wanted HomePage.html (note the capitalization), and a third wanted default.html. My Webmaster wizards here at HTML Goodies tell me that you can configure a server to search for booger.html if you really want to. But that would lead to a sticky situation. *Rim-shot* (Thank you, folks, good night! Try the veal.)





How To Do It

     Geez, it took me a while to get to this, didn’t it? I tend to ramble. So, how do you do it? Well, the rule of thumb here is to remember that any subdirectory (a directory inside a directory) retains all the properties of the parent directory.



Huh?



     Any directory inside a bigger directory will do what the big directory does, just because. (That’s my best “Gen-X” speak.)

     So, if you make a directory inside of wwwuser, then that directory will also display its own index.html. If you make a smaller directory inside that directory, then it will display its own index.html. Get it?





Creating A Directory

     I have received so many letters telling me that I go the long way in making a directory. True, there are software programs out there that will do all of this with the click of a button, but in case you don’t have such an animal, try this. If you do have a program that will do all of this on the fly, go nuts.

  1. Telnet into your site.
  2. Get to your directory. Usually when you telnet into your site, you are either in, or one directory above, your www directory where you keep all your files.
  3. Try typing at the prompt: cd [name of your www directory]


  4. If that doesn’t work, type cd .. (two periods) and then try step 3 again. If you don’t get any errors, you’re there.


  5. If you would like, you can type ls at the prompt and that will give you a listing of all your files.
  6. To create the directory, type mkdir [directory name]


  7. You can now do another ls command and you should see that directory sitting there.


  8. Some servers need for that directory to be “turned on” before anyone can use it. So, just to be safe, type chmod [directory name] a+rx now. If the server won’t take that command, try substituting a+rx with 777.


  9. Log out. You’re done.

     Now you have a second directory sitting inside of your wwwuser directory. That directory will respond to its own index.html. Let’s say you named the directory “skippy.” Now you can tell people to go to:



http://www.fred.com/~wwwuser/skippy


     …and they’ll get the main page with no html. Now, how easy it that? Once you do it, it’s a joke the second time.





The Big Hint

     I’m going to tell you right up front what will mess you up: You will replace the wrong index.html with the wrong index.html at least once. I will bet you a zillion clams. I’ve done it at least 10 times. Always make a point of checking your work after you transfer stuff. That allows your mistakes to be fixed straightaway. Bye-bye!


[The Index Page]
[How To Do It]
[Creating A Directory]
[The Big Hint]


 

[Back to HTML Goodies]

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured