Space Pirate
Join Date: May 2004
Location: Atlanta
|
I've set up a new website using PHP but to my surprise the index page (index.php) doesn't automatically load in Safari or Firefox. Can anyone enlighten me as to what I'm supposed to do to make a PHP index page load automatically like HTML index pages normally do? Am I supposed to alter the .htaccess file? Keep banging the rocks together?
|
quote |
‽
|
Quote:
Presumably, you're on something Apache-based. To make Apache look for index.php files, make sure the DirectoryIndex directive includes that. You can enforce this with .htaccess like this: DirectoryIndex index.php You should give more information first what kind of server you're talking about though. |
|
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Bingo, Chucker.
It's Apache-based and it's working now. That bit you mentioned... Code:
DirectoryIndex index.php .... did the trick.I just found an article with your same tip in it (in the WordPress docs) and came back here to post that I'd found it. Good show sir, this here programmers forum is pretty spiffy. Now to bang out the CSS browser bugs in the website.... if anyone is interested the site is www.film-ga.com and is still in giddy first-legs mode~ |
quote |
‽
|
Glad to be of help.
|
quote |
Less than Stellar Member
|
Make sure you don't remove the reference in that line to "index.html". Just put it after the index.php reference. This way, if you don't have an index.php file in the directory, but an index.html, it will automatically load that. I usually add index.htm just for good measure.
edit: I just realized that you're probably not making changes to the httpd.conf file, so never mind. If you are reading this and making changes to the httpd.conf file on your local box, the above applies. If it's not red and showing substantial musculature, you're wearing it wrong. |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Nope, not messing with the httpd.conf file (whatever that is!!).
For confirmation, I did not create a reference to index.html or index.htm in the .htaccess file and am curious if I need to do so (even after reading your edit Tori). I don't have access to that domain while I'm at work so I can't do a quick experiment to see what would happen if I only had an .html or .htm file in there. What's the normal setup for how these things behave? |
quote |
monkey with a tiny cymbal
Join Date: Nov 2004
Location: Lost
|
I believe .htaccess will override all previous settings. So, you'll want it to say
Code:
DirectoryIndex index.html index.htm index.php or whatever in the order that you want it.Just a note to everyone else - .htaccess is disabled by default on Mac OS X. So, if you're locally serving your webpages, you'll want to make these changes inside /etc/httpd/httpd.conf. And if you want to enable .htaccess, you'll need to change your httpd.conf file such that the second "AllowOverride None" directive becomes "AllowOverride All." And, you'll need to make the same change in /etc/httpd/users/your_username.conf. And then if you're using Virtual Servers, you'll need to add "AllowOverride All" into your virtual server block in httpd.conf. But, you don't want to enable .htaccess if you don't have to... you end up with a performance hit since Apache looks through every single directory on its way to the file requested for an .htaccess file. Yeah, I just spent three hours figuring all that out. Figured I'd leave it all here for posterity. |
quote |
25 chars of wasted space.
|
Although the speed his is rather negligable. Maybe more if you are using are hosting locally though.
|
quote |
Posting Rules | Navigation |
|
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Empty files copied from networked drive | skid_boy_99 | Genius Bar | 0 | 2005-10-04 04:23 |
Automator Renaming Files In Random Order | YouCanHaveYourPC | Apple Products | 4 | 2005-08-29 19:02 |
PHP : Passing declared variables to REQUIRE'd files. | drewprops | Genius Bar | 9 | 2005-01-11 00:03 |