Current time: 04-20-2014, 06:25 AM Hello There, Guest! (LoginRegister)

Post Reply 
Alternate names for index.html
12-06-2001, 01:41 AM
Post: #1
Alternate names for index.html
I would like to have my default homepage point to something like index_christmas.html, index_newyear2002.html, etc.
Is such a thing possible?
Thanks, and happy holidays
Visit this user's website Find all posts by this user
Quote this message in a reply
12-06-2001, 02:55 AM
Post: #2
Alternate names for index.html
Yes it is. If you must! :-)

Create a new plain text file using Notepad or equivalent.

Write the following line into the file:

Code:
DirectoryIndex index_christmas.html
Save the file named .htaccess

(Note that the leading period is intentional.)

Upload the file to the directory where you wish this directive to take place. Upload in ASCII transfer as this is only a plain text file after all.

And pronto. The web server should look for the file specifided in the .htaccess file as the default index for that directory.

Hope this helps.

Wil
Find all posts by this user
Quote this message in a reply
12-06-2001, 03:15 AM
Post: #3
Alternate names for index.html
well the easiest thing is probably to rename your index page, but you should be able to create a text file named '.htaccess' with the line:
DirectoryIndex index.html index.htm My_kewl_index_page.htm

where 'My_kewl_index_page.htm' is the name of your index page.

i'd personally suggest just renaming your page though :> generally, the browser bar will just say:
http://veggiechinese.net/
instead of:
http://veggiechinese.net/My_kewl_index_page.htm

you can also use an .htaccess file to _redirect_ to the URL you want; this requires the use of <meta> tags, so you'd create a refresh tag in your index.html page that redirects to the page you want. this _will_ change the browser URL.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-06-2001, 05:41 AM
Post: #4
Alternate names for index.html
I'm just curious why you would bother doing this. If you are thinking of saving old home pages, you could simply RENAME them while keeping the current as index.html. In this way, you'll save a lot of time and work.

Alternatively, you may also REDIRECT index.html to whatever.html; visitors to yourdomain.com/ would automatically be forwarded; since you have access to your root (where you place your .htaccess file), it's much better than the meta tags REFRESH command (which is slower).
Find all posts by this user
Quote this message in a reply
12-06-2001, 03:00 PM
Post: #5
Alternate names for index.html
Actually, you can list *several* different names in the DirectoryIndex directive.

If you list

DirectoryIndex index.html index.htm /noindex.html

then the server will display the first file it comes across in the list. If you have software that names your files with .htm instead of .html, this would make the server display index.html if there was one, and if not, look for an index.htm, and then look for a noindex.html file in your *root* directory, before giving up and listing all the files in the directory.

The advantage of having a /noindex.html file is that if someone snoops in a directory where you forgot to put an index.html file, you can display a page that says "Private. No girlz aloud" like the little boys' treehouse.

Not letting people know any more than necessary about your file structure is called "security by obscurity" and it's not the most effective security tool, but it can help a little, and at the cost of virtually no effort.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-07-2001, 02:07 AM
Post: #6
Alternate names for index.html
Thanks for your help -- you were absolutely right! It is a lot easier to rename individual "homepages" according to the season etc: I was looking for an easier way out -- but it's good that I've cleaned out my folders.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-07-2001, 06:06 PM
Post: #7
Alternate names for index.html
Quote:Actually, you can list *several* different names in the DirectoryIndex directive.

Yep - i should have made this clearer in my example (although i did specify several).

Quote:The advantage of having a /noindex.html file is that if someone snoops
in a directory where you forgot to put an index.html file, you can display
a page that says "Private. No girlz aloud" like the little boys' treehouse.

You can also just put:
Options -indexes
in an .htaccess file to disable index browsing in a particular directory tree. This will just go to a regular generic 403 error page though.

You can re-enable it for a particular directory tree with:
Options +indexes.

I didn't know about the /noindex.html thing though - that's pretty cool.

Note that using the DirectoryIndex tag at all will override our defaults (which have index.phtml, index.cgi, etc. listed) so you might run into problems if you don't specify a full list.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-07-2001, 07:29 PM
Post: #8
Alternate names for index.html
I hope I haven't confused anyone with /noindex.html

There isn't anything special about the "noindex" name. You can call it anything you want to. And you *do* have to create a page if you want your own message to display.

What I was trying to point out is that you can specify a file in a different directory. And it doesn't have to be a static web page. You could use

DirectoryIndex index.html /cgi-bin/ginrummy.cgi

if you want....
Visit this user's website Find all posts by this user
Quote this message in a reply
12-09-2001, 08:10 AM
Post: #9
Alternate names for index.html
A better way of doing this would be to redirect Error requests to purposed made documents, though. I think the Dreamhost servers are already set up for all 404 and 500 errors to go to /error.html ???

Just use the Options NoIndex directive to override the default.
Find all posts by this user
Quote this message in a reply
12-11-2001, 01:44 PM
Post: #10
Alternate names for index.html
Hey, thebeck...

I kinda approach it from the opposite direction; I rename the non-current indexes with their own monniker so I know who everyone is. Like:

spring_index.html
summer_index.html
fall_index.html
index.html <-- This one's the current "winter" index

In the spring, I'd rename index.html to winter_index.html and change spring_index.html to index.html.

That way, there's no need to mess around with .htaccess and such.

Have fun!

...Bob W.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: