index.htm vs index.php

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

index.htm vs index.php

Postby inkhana » Mon Dec 01, 2003 1:46 pm

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*

:sweat: Did I explain that very well? -_-


BOOSTER: Hey, No.1! Where's my cake?!
SNIFIT 1: Booster, Sir! There's a 70% chance the object you're standing on is a cake.
BOOSTER: What? THIS thing's a cake?

You have the power to say anything you want, so why not say something positive?
- Frank Capra

(in response to an interview question "Do you have a pet peeve having to do with this biz?")
People who write below their abilities in order to crank out tons of books and make a buck. Especially Christian authors who do that. Outsiders judge us for it, and make fun of us for it, and it makes Jesus look bad. We of all artists on earth should be the most concerned with doing our best possible work at all times. We of all people should write with all our hearts, as if writing for the Lord and not for men.
- Athol Dickson


Avatar by scarlethibiscus from LJ.
User avatar
inkhana
 
Posts: 3670
Joined: Fri May 30, 2003 10:00 am
Location: meh.

Postby andyroo » Mon Dec 01, 2003 3:59 pm

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.
"As vinegar to the teeth and smoke to the eyes, so is a sluggard to those who send him." ~Proverbs 10:26
†
The Ideas Behind Anime |

The difference between intelligence and stupidity is that intelligence has its limits.
A proud member of P.I.E. -- Pictures of Inkhana for Everyone! Join the fight!
User avatar
andyroo
 
Posts: 815
Joined: Tue Jun 10, 2003 11:00 am
Location: Alabama

well

Postby animenewstoday » Mon Dec 01, 2003 4:47 pm

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
User avatar
animenewstoday
 
Posts: 138
Joined: Sat Sep 06, 2003 4:45 pm

Postby shooraijin » Mon Dec 01, 2003 6:32 pm

> 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 :sweat: ), 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;
?>
"you're a doctor.... and 27 years.... so...doctor + 27 years = HATORI SOHMA" - RoyalWing, when I was 27
"Al hail the forum editting Shooby! His vibes are law!" - Osaka-chan

I could still be champ, but I'd feel bad taking it away from one of the younger guys. - George Foreman
User avatar
shooraijin
 
Posts: 9927
Joined: Thu Jun 26, 2003 12:00 pm
Location: Southern California

Postby TheMelodyMaker » Mon Dec 01, 2003 7:20 pm

You could also just rename "index.php".
[color=RoyalBlue]@)}~`,~ [/color]Carry this rose in your signature as thanks to Inkhana, for all she has done for us in the past.Even though she is no longer a moderator, she has done an awful lot for us while she was and she deserves thanks. ^_^
TheMelodyMaker
 
Posts: 1904
Joined: Sun Jul 20, 2003 10:13 pm

Postby shooraijin » Mon Dec 01, 2003 7:43 pm

Yes, but if the BB system has direct links to it, this could bust them. Smoking out all those instances would be a pain.
"you're a doctor.... and 27 years.... so...doctor + 27 years = HATORI SOHMA" - RoyalWing, when I was 27
"Al hail the forum editting Shooby! His vibes are law!" - Osaka-chan

I could still be champ, but I'd feel bad taking it away from one of the younger guys. - George Foreman
User avatar
shooraijin
 
Posts: 9927
Joined: Thu Jun 26, 2003 12:00 pm
Location: Southern California

Postby Mithrandir » Mon Dec 01, 2003 8:23 pm

... 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?"
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby inkhana » Mon Dec 01, 2003 10:02 pm

>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.


BOOSTER: Hey, No.1! Where's my cake?!
SNIFIT 1: Booster, Sir! There's a 70% chance the object you're standing on is a cake.
BOOSTER: What? THIS thing's a cake?

You have the power to say anything you want, so why not say something positive?
- Frank Capra

(in response to an interview question "Do you have a pet peeve having to do with this biz?")
People who write below their abilities in order to crank out tons of books and make a buck. Especially Christian authors who do that. Outsiders judge us for it, and make fun of us for it, and it makes Jesus look bad. We of all artists on earth should be the most concerned with doing our best possible work at all times. We of all people should write with all our hearts, as if writing for the Lord and not for men.
- Athol Dickson


Avatar by scarlethibiscus from LJ.
User avatar
inkhana
 
Posts: 3670
Joined: Fri May 30, 2003 10:00 am
Location: meh.

Postby LorentzForce » Mon Dec 01, 2003 10:11 pm

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!
Image
User avatar
LorentzForce
 
Posts: 1263
Joined: Sun Jun 01, 2003 3:18 am
Location: Between B and E

Postby Mithrandir » Mon Dec 01, 2003 10:26 pm

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
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby LorentzForce » Mon Dec 01, 2003 10:32 pm

even though i do not know the exact forum inkhana uses, most forums should allow that.
Image
User avatar
LorentzForce
 
Posts: 1263
Joined: Sun Jun 01, 2003 3:18 am
Location: Between B and E

Postby Straylight » Tue Dec 02, 2003 5:46 am

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.
[align=center]
Image
Banner above created using my avatar generator tool.
You know you want try it.
User avatar
Straylight
 
Posts: 2346
Joined: Mon May 26, 2003 12:00 pm
Location: Manchester, UK

Postby inkhana » Tue Dec 02, 2003 8:59 am

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).


BOOSTER: Hey, No.1! Where's my cake?!
SNIFIT 1: Booster, Sir! There's a 70% chance the object you're standing on is a cake.
BOOSTER: What? THIS thing's a cake?

You have the power to say anything you want, so why not say something positive?
- Frank Capra

(in response to an interview question "Do you have a pet peeve having to do with this biz?")
People who write below their abilities in order to crank out tons of books and make a buck. Especially Christian authors who do that. Outsiders judge us for it, and make fun of us for it, and it makes Jesus look bad. We of all artists on earth should be the most concerned with doing our best possible work at all times. We of all people should write with all our hearts, as if writing for the Lord and not for men.
- Athol Dickson


Avatar by scarlethibiscus from LJ.
User avatar
inkhana
 
Posts: 3670
Joined: Fri May 30, 2003 10:00 am
Location: meh.

Postby Straylight » Tue Dec 02, 2003 11:32 am

There should be a header template, so you can change the ref once, and the change you make will appear on every forum page.
[align=center]
Image
Banner above created using my avatar generator tool.
You know you want try it.
User avatar
Straylight
 
Posts: 2346
Joined: Mon May 26, 2003 12:00 pm
Location: Manchester, UK

Postby inkhana » Tue Dec 02, 2003 11:51 am

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! :thumb:

Thanks guys!


BOOSTER: Hey, No.1! Where's my cake?!
SNIFIT 1: Booster, Sir! There's a 70% chance the object you're standing on is a cake.
BOOSTER: What? THIS thing's a cake?

You have the power to say anything you want, so why not say something positive?
- Frank Capra

(in response to an interview question "Do you have a pet peeve having to do with this biz?")
People who write below their abilities in order to crank out tons of books and make a buck. Especially Christian authors who do that. Outsiders judge us for it, and make fun of us for it, and it makes Jesus look bad. We of all artists on earth should be the most concerned with doing our best possible work at all times. We of all people should write with all our hearts, as if writing for the Lord and not for men.
- Athol Dickson


Avatar by scarlethibiscus from LJ.
User avatar
inkhana
 
Posts: 3670
Joined: Fri May 30, 2003 10:00 am
Location: meh.


Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 85 guests