"index page" for php

Anonymous Coward (not verified)

Posted: Sat, 2005-10-08 01:36

The following information is required to get an answer:
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful): not yet
Gallery version: Gallery 2
Apache version: ?
PHP version (don't just say PHP 4, please): ?
Graphics Toolkit: ?
Operating system: Max OS X 10.3.4
Web browser/version (if applicable): Safari 1.2, Opera 8.5, Camino 0.8
(I HAVE NO IDEA WHAT A CONFIGURATION WIZARD IS SO CAN"T ANSWER ALL THE QUESTIONS)

Normally I have an index.html file that blocks access to the root of the directory. However, for my Gallery, it uses main.php which means visitors would end up with full access to my directory!! How do I block. Web host is Dreamhost if that means anything.

 
dorth

Joined: 2002-10-09
Posts: 27
Posted: Sat, 2005-10-08 04:11

Web servers are configured to recognize certain file names and extension combinations and will automatically server those file types if just the directory is requested. So when you type in http://www.google.com, you actually get served up http://www.google.com/index.html (though that is usually hidden from you.) A typical web server configuration will have several options and might look something like:

index.html, index.htm, main.html, main.htm, index.pl, index.php

If you have one of those filenames in a directory, that file will be served up without having to specifically request it. Please note that this has nothing to do with "blocking" access to other files in that directory (although it does hide them from view.) The "blocking" of access to files in the directory is done by a different web server configuration option which is usually called "Indexes". If "Indexes" are allowed on that directory and there is no matching filename (index.html, etc.), then a directory listing of all files will appear. If "Indexes" are not allowed, then you will get a "File not found" error. The "Indexes" command can be centrally configured on a per directory basis. It can also be delegated to a user level by reading a file named .htaccess. There are a lot of really good tutorials on .htaccess, so I won't go into that here. If your web server is configured to use .htaccess files (many web hosting plans offer this), then you can "block" access to directory listings by creating a .htaccess file containing something like:

Options Indexes

I believe all of the gallery directories use .htaccess files to control access to directory listings. If you are getting directory listings inside those directories, I suspect that your web server is not configured to allow .htaccess control. This is normally something that is called out in the "Configuration Wizard" - which is something you'd have to go through to configure Gallery. If you don't know what the "Configuration Wizard" is, or you haven't run through it to set up your gallery, then you need to get that done before you'll get too much farther.

Sorry to be so long winded.

Dave O

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-10-08 06:19
raizel wrote:
Normally I have an index.html file that blocks access to the root of the directory. However, for my Gallery, it uses main.php which means visitors would end up with full access to my directory!! How do I block. Web host is Dreamhost if that means anything.

So you haven't even tried installing G2 yet then? :)

There is an index.php at the root of the g2 install that redirects to main.php. As long as Apache is configured to use index.php as one of the index pages you don't have to worry about a thing.

To disable directory browsing, put this in your .htaccess file
Options -Indexes

dorth, G2 does not do any type of directory access control.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
raizel (not verified)

Posted: Sat, 2005-10-08 14:27
dorth wrote:
Web servers are configured to recognize certain file names and extension combinations and will automatically server those file types if just the directory is requested. ... A typical web server configuration will have several options and might look something like: index.html, index.htm, main.html, main.htm, index.pl, index.php
Dave O

Hi -- I dropped an email to my webhost to confirm "main.php" is on their list as defaults. When I acted as web admin of a server, I know I made up as many combos as possible (PHP wasn't around back then :).

My host does recognize .htaccess but it's the above "default" I want. Just for the simplicity of passing on the URL to friends.

 
raizel (not verified)

Posted: Sat, 2005-10-08 14:33
nivekiam wrote:
raizel wrote:
So you haven't even tried installing G2 yet then? :)

Wrong I have it fully installed! It's a "one-step install" service from my web host. Easy peesy. From their admin panel you choose Gallery 2, it starts its magic and you get an email to continue the config. It does what I saw has to be done in the "install instructions". Whew, I would never have attempted self-install <GRIN>

However, no mention of index... or main... is mentioned. I would have assumed (as mentioned in my other reply, "main.php" was common enough to have been on my web host list as "default" for /. I should not have to use .htaccess configuration, it's simply to let visitors type the domain name and have the / recognized as a page, not directory listing. (Yes, my host supports .htaccess).

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-10-08 15:49

You don't want or need main.php as an index page, if you read my post, you need index.php to be listed as an index page for Apache.

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
raizel (not verified)

Posted: Sat, 2005-10-08 21:18
nivekiam wrote:
You don't want or need main.php as an index page, if you read my post, you need index.php to be listed as an index page for Apache.

Boy is my face RED!! I forgot the album is in a subdirectory. It's got the index.php. It's the root that didn't have one because _I_ forgot to create one. back to HTML school 101 <LAUGH>. Loaded a temp index.html that links to my subdirectorys index.php. All better. Thank you.