Forum Moderators: mack

Message Too Old, No Replies

php and apache on windows problem

directing to a folder won't find index.php file

         

proper_bo

7:44 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



I finally got round to installing php apache and mysql on my computer and it all works beautifully,

The only problem I am having is that if I direct a page to a folder not an actual index file it won't find it.
Normally if you direct to say .com/hello/ it would find the index.php file that is in the hello folder. Have I got a setting wrong or is there a way to change this behavour.
Also while I am here, if I want to direct back to the homepage can I just put '/'? or do I have to do .com/index.php

Thank you for your responses.

mack

9:08 pm on Mar 25, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



First off I am no Apache expert :)

I think you may need to alter your apache configuration file. httpd.conf

From there you are able to specify the "default" file extentions for directories.

If you use a simple html file and call it index.html does that work when you go to the /directry/?

Mack.

grahamstewart

10:30 pm on Mar 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Open up your httpd.conf file for Apache.

Find this bit..


<IfModule mod_dir.c>
DirectoryIndex index.html
</IfModule>

and change it to this...


<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>

..or this..


<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>

The order specifies which page should be served if an index.html and an index.php both exist.

proper_bo

11:13 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



My thanks to both of you for your replies. I now have it working perfectly.

A final note though. It works fine when there is a forward slash on the end of the folder name (folder/) but not when there isn't. I am assuming that the correct way is to use forward slashes after and the fact that it works on the server without them is just luck. Correct?
I checked the bbc website and all 'no file name' links have a following slash.

Once again, thank you very much.

coopster

12:07 am on Mar 26, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Do a search on WebmasterWorld for "apache server trailing slash" and you should get plenty of info. Apache's mod_dir [httpd.apache.org] and mod_rewrite [httpd.apache.org] should provide some answers as well...