Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder ArcticFox's Avatar
    Join Date
    Jan 2004
    Location
    Vostok Station, AQ
    Posts
    602
    Thanks
    35
    Thanked 3 Times in 3 Posts

    Internet Explorer index.php vs index.html

    index.php vs index.html

    Is there any reason for me to have two pages?

    If my site is in PHP, is there a situation where the browser won't go to an index.php page?
    <div> - putting your mind in a box since 1997

  • #2
    New Coder
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    91
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Normally when you have an index.html and an index.php file, the index.html file should be displayed. Comes in handy when updating your site, you can show an index.html file so people see it's being updated.
    Thank you for your time to read my post

  • #3
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    You can use both and just refresh to index.php, the reason is when you change your code on your site the index.php sometimes takes about 2 hours to refresh on certain ISP's so you wont see changes straight away.

    I am not sure how your ISP works, but mine says wait two hours or less.
    I know that you can use no cache not to cache the page but that's another post.
    Cheers
    West
    Thanks for you support!

  • #4
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    You could meta refresh to the index.php or use JavaScript

  • #5
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    the reason is when you change your code on your site the index.php sometimes takes about 2 hours to refresh on certain ISP's so you wont see changes straight away.
    I know I would personally never consider a host with such a curious operating structure. There is no need to have to wait 2 hours.

    One of my hosting providers sometimes (once or twice during sessions) will take a minute to update. To me this is too much already.

    Is there any reason for me to have two pages?
    There is virtually no reason. Your server determines which is picked. No browser inadequacy will ever require an index.html.

    Normally when you have an index.html and an index.php file, the index.html file should be displayed. Comes in handy when updating your site, you can show an index.html file so people see it's being updated.
    This is the only reason to have an index.html file around, but it wouldn't contain the actual site. Your server would have to be set up to prefer index.html over index.php (which it usually is). Even then, a page like this shouldn't be necessary with PHP.

  • #6
    New Coder
    Join Date
    Mar 2007
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tend to use the .htaccess file to tell each directory which file should be opened by default.. and then I don't have a whole bunch of index.* files to deal with. I find this helpful. A friend recently copied the wrong index.* file into one his directories, and then discovered hours later that he'd screwed up. Seems easiest to me to keep them named for the project, and then even if one is accidentally FTP'd to the wrong area it won't make any difference as it won't be used anyway. Pluses or minuses to this approach?
    Think slow, type fats

  • #7
    Regular Coder westmatrix99's Avatar
    Join Date
    Dec 2006
    Location
    South Africa
    Posts
    307
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ArcticFox View Post
    index.php vs index.html
    Is there any reason for me to have two pages?
    If my site is in PHP, is there a situation where the browser won't go to an index.php page?
    I like Sylvester21's idea it works, or get ".htaccess" help and work from there.


    Cheers
    West
    Thanks for you support!

  • #8
    New Coder
    Join Date
    Mar 2007
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Following up on this, but perhaps at a bit of a tangent, do folks generally name their pages .php when the pages contain any PHP code at all?

    I'm thinking of cases where 99% of the page is straight HTML, with just a line or two of PHP code inserted where needed. Is there any advantage or disadvantage to naming such pages with .html? I'm learning PHP now, and tend to name the page for the predominant code used. Even when named .html, all but the *output* of the PHP code will still be hidden from anyone downloading the page, correct?
    Think slow, type fats

  • #9
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    If it contains, it -should- be named .php.

    This is similar to using <? instead of <?php. It works, as long as your server is configured to support it, but not all servers are.

    Not all servers are configured to treat normal .html files as containing PHP code. Most likely very few of them are.

    Also, don't use the .inc or .include extension for files you include.

  • #10
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,078
    Thanks
    11
    Thanked 98 Times in 96 Posts
    Quote Originally Posted by aedrin View Post
    I know I would personally never consider a host with such a curious operating structure. There is no need to have to wait 2 hours.
    Sadly many smaller ISP's in backward countries like Australia (I kid you not) still use proxy servers with ridiculous cache times.

    Quote Originally Posted by RTrev
    Is there any advantage or disadvantage to naming such pages with .html?
    You can configure your webserver to parse .html as .php but that means an extra load on pure html pages that are then thown through the parser without reason.

    Quote Originally Posted by ArcticFox
    If my site is in PHP, is there a situation where the browser won't go to an index.php page?
    depends how your webserver is configured ... with the following the php file will always be parsed first, but different hosts do things in different ways.
    (.htaccess or server config)
    DirectoryIndex index.php index.html

    using index.html as an 'offline, back soon' sort of page has merits but you still need to rename the index.php or the DirectoryIndex directive to force its use
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #11
    New Coder
    Join Date
    Mar 2007
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by aedrin View Post
    If it contains, it -should- be named .php.

    This is similar to using <? instead of <?php. It works, as long as your server is configured to support it, but not all servers are.

    Not all servers are configured to treat normal .html files as containing PHP code. Most likely very few of them are.

    Also, don't use the .inc or .include extension for files you include.
    Ahah, I guess the 1&1 servers must be set to run .html files through the PHP parser.. as they work. I'll rename to .php -- thanks for the heads up on that one!
    Think slow, type fats


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •