Page 1 of 1
index.htm vs index.php
PostPosted: Mon Dec 01, 2003 1:46 pm
by inkhana
That was an inane title but I don't care...
Anyway, I have these two files in a directory, we'll call it http://www.mysite/forum for ease of reference. I have an Invision board installed there. However, I don't want the forum to be the first thing displayed when I enter "http://www.mysite/forum" for my link, I want it to show the HTML file instead. I am not really sure why it prefers the php file, but even when I put them in the same directory together, it shows the php file by default. This is a Linux server. Anyone got any ideas how to change this behavior? It's not really imperative or anything; I just don't understand why it does that even though index.htm comes before index.php alphabetically. *sigh*
Did I explain that very well? -_-
PostPosted: Mon Dec 01, 2003 3:59 pm
by andyroo
I tried this on my web site, but I used index.htm vs. index.shtml. The best explination I could find is just adding an 'l' to your file name extension (i.e. index.html). When I used '.htm' vs. '.shtml' the '.shtml' page became the set index page. Maybe the same thing is happening with the index.htm and index.php.
well
PostPosted: Mon Dec 01, 2003 4:47 pm
by animenewstoday
inkhana wrote:[color=darkgreen]That was an inane title but I don't care...
Anyway, I have these two files in a directory, we'll call it
http://www.mysite/forum for ease of reference. I have an Invision board installed there. However, I don't want the forum to be the first thing displayed when I enter "http://www.mysite/forum" for my link, I want it to show the HTML file instead. I am not really sure why it prefers the php file, but even when I put them in the same directory together, it shows the php file by default. This is a Linux server. Anyone got any ideas how to change this behavior? It's not really imperative or anything]
if i were you, you could make a redirect link for example when you go to your forums it will redirect it to go to your index.htm if that's what you mean
PostPosted: Mon Dec 01, 2003 6:32 pm
by shooraijin
> However, I don't want the forum to be the first thing displayed when I enter "http://www.mysite/forum" for my link, I want it to show the HTML file instead.
Since this is Linux, you're probably using Apache. I'm no Apache guru (heck, I don't even like it very much, so I wrote my own! --
http://httpi.floodgap.com/ -- okay, end shameless plug
), but it seems like the PHP module is getting precedence over the default handlers. Look at this page:
http://httpd.apache.org/docs/mod/mod_dir.html
What your admin (or you, if you can control this yourself) needs to do is re-order the DirectoryIndex line so that index.html comes before index.php.
If you can't control for this, do you have any need to have index.php at all? Does it have any totally important function? If not, edit the file and replace it with this instead:
- Code: Select all
<?php
header("Location: index.html");
exit;
?>
PostPosted: Mon Dec 01, 2003 7:20 pm
by TheMelodyMaker
You could also just rename "index.php".
PostPosted: Mon Dec 01, 2003 7:43 pm
by shooraijin
Yes, but if the BB system has direct links to it, this could bust them. Smoking out all those instances would be a pain.
PostPosted: Mon Dec 01, 2003 8:23 pm
by Mithrandir
... So I asked myself, "Do I have access to the the config files for apache?" The answer came back, echoing in the distance.
"What's up at she?"
PostPosted: Mon Dec 01, 2003 10:02 pm
by inkhana
>What your admin (or you, if you can control this yourself) needs to do is re-order the DirectoryIndex line so that index.html comes before index.php.>
Unfortunately, I don't have that level of control at my disposal. Although yes, it is Apache I'm dealing with.
If you can't control for this, do you have any need to have index.php at all? Does it have any totally important function?
Index.php is what is responsible for providing the front page to the forums, so I really am not able to change it. It sounds like this would be a really difficult procedure for a server n00b to execute...I wonder if I would be able to contact my provider and they could take care of it...
I just never honestly expected that php would take precedence over html files.
PostPosted: Mon Dec 01, 2003 10:11 pm
by LorentzForce
well, it does.
if you can, it's possible to program the site that creates a cookie or such that detects if the user is to go to index.html or continue loading index.php. if there is no such cookie or data on that specific computer, then load index.html. when the person goes back, load index.html instead of index.php.
i think it's just a longshot work. ways to go around it other than fixing it directly in Apache console is pretty vague and weird, and quite possibly lead to numerous bugs that are plainly pointless to attempt.
so good luck contacting the providers!
PostPosted: Mon Dec 01, 2003 10:26 pm
by Mithrandir
Question: Can you install the forum in a subdirectory, and point your index.html file to that?
eg:
http://mysite.com/forum/index.html
would point to:
http://mysite.com/forum/myforum/index.php
PostPosted: Mon Dec 01, 2003 10:32 pm
by LorentzForce
even though i do not know the exact forum inkhana uses, most forums should allow that.
PostPosted: Tue Dec 02, 2003 5:46 am
by Straylight
You could rename index.php to something "forum_index.php" and change the header templates that link to it to point to the new filename instead. I know vB doesn't mind - you just have to change the <a href> reference in the header template and everything works spiffy.
Keeping your forums in a subdirectory is definately the best way though.
PostPosted: Tue Dec 02, 2003 8:59 am
by inkhana
Well, that would be the best answer, but unfortunately I don't own the server in question and I just have use of subdirectories (in other words, if I change the homepage, my dad will...hurt me. LOL) However, that idea about changing all header refs to forum_index.php might do the trick...it would take a bit of doing, but I don't think it's out of the question (for my skill level, that is).
PostPosted: Tue Dec 02, 2003 11:32 am
by Straylight
There should be a header template, so you can change the ref once, and the change you make will appear on every forum page.
PostPosted: Tue Dec 02, 2003 11:51 am
by inkhana
Ah, I think I've got it now...^^
>What your admin (or you, if you can control this yourself) needs to do is re-order the DirectoryIndex line so that index.html comes before index.php.>
I got access to the .htaccess file and added "directoryindex index.htm" and now it works great!
Thanks guys!