PDA

View Full Version : iWeb: changing "home.html" to "index.html" breaks links



ScottC
01-20-2009, 12:15 AM
Hi,
My web page won't show up on Hostmonster.com unless I rename the "home.html" "index.html." The site works, except that none of the other pages will link back to home. I did try editing with hostmonster.com's html editor, but it doesn't seem to work (iweb uses some other language?). I'd rather not name my home page "index"--is there some other way to keep the default page "home" and keep the links back to it active?

According to my wife, who's better versed in web tech, the iWeb pages are not constructed with html. They don't use the word "home" to make links. Any suggestions on what to look for in the code editor, and what to change it to?
thanks,

shadmego
01-20-2009, 12:36 AM
The standard for naming a home page is index.html (or index.htm, default.html, or index.php).

I would simply suggest you name your home page index.html and go through all your other pages to change the link to your home page to reflect the change. If you have a bunch of pages, you might want to think about using some sort of include code on all your pages. Making your menu system its own file and including it in all your other pages will drastically cut down on your update time if you have to add or take away a page.

I'm not familiar with iWeb, but all websites are built with html. There might be other languages that make up the core of the site, like php, asp, coldfusion and others, but all these languages and technologies always output html to the browser window.

You might also be able to get away with not changing your links if you know a bit of .htaccess code to make the browser look for home.html instead of index.html, but I still think your best bet would be to change the links to your home page.

If you want to do this directly inside the html code, look for tags that look similar to this:


<a href="home.html">Home</a>

And change it to something similar to this:


<a href="index.html">Home</a>

~regards

sdasevne
01-20-2009, 04:24 PM
How about if you just load home.html AND index.html? That way you wouldn't have to change any links.

ScottC
01-20-2009, 09:15 PM
To those that answered:
Apparently I can't have both an index.html and a home.html file at the same time--the page won't load.

I can't change the code on my Mac, and haven't found where I can change home to index on the other pages.

Any more advice?

pghcollectibles
01-20-2009, 10:19 PM
the proper thing to do is rename all the links and home.html to index.html ...

here is a work around. the only issue you are having has to do with the initial domain loading.

create a file named index.php in your public_html folder (this is for your main domain?).
edit the file with file manager from your cpanel, add the following code and click save, your done.


<?php header("Location: http://yourdomainname/home.html"); ?>

ScottC
01-21-2009, 11:03 AM
Thanks for the suggestion. Should I use all characters above (including the < and > on the ends)? Sorry, I'm not used to writing code. Last time was using pascal in physics lab in 1982.
Also, should the index.php replace the index.html file, or should I have both?
thanks

r2b2
01-21-2009, 12:09 PM
The other possibility is to add a DirectoryIndex directive into the .htaccess file
e.g.
DirectoryIndex home.html

This will make home.html the default page should you not specify a file

pghcollectibles
01-21-2009, 01:10 PM
if you were renaming everything in order to have the index.html file, then that is all you would have to do. (that would be the recommended way) if you were to leave everything the way it was, you could do the php way or the htaccess way both are work a rounds. the bottom line is that people see what they are supposed to see (no broken links) the method you use to get it does not always matter, but could lead to other issues in the future if you get in the habit of creating work a rounds.

if you are going to just add the index.php file, then yes copy the code above (including the brackets <>) those are start and end tags stating there is php code inside that the server needs to process before it sends the page to the client's browser



<?php
header("Location: http://yourdomainname/home.html");
?>


we are using the header function from php. here (http://us3.php.net/manual/en/function.header.php) is a reference

ScottC
01-21-2009, 07:15 PM
Thanks, looks like it worked.