Changing index.php to index.html

Posted on 2011-05-12
Last Modified: 2012-05-11

I have taken over a website which was created using Mambo and the login details have been lost by the creator! I also have no experience of Mambo and intend to change the site over to Wordpress at some point.

The issue is that I want to take the site temporarily offline using a quick change that can be reversed just as quickly.

The index page is currently index.php - can I rename this page to (say) indexbackup.php and insert an index.htm as a holding page? Would there be any issues replacing a .php page with an html page (temporarily)?

Thanks for your help.
Question by:CSHTech
    LVL 14

    Expert Comment

    Probably.  It depends what the page uses PHP for.  I assume you want everything to look the same, so you'll have to look through the PHP code and see if it's getting any dynamic content from anywhere.
    You could make a quick head start on the html page by just browsing to the php page, then right-click, view source and save the html text you see into a html file.
    LVL 82

    Assisted Solution

    You should be fine.  You will just have to provide ALL the content on the html, since nothing will be generated dynamically (like it is in PHP).
    LVL 107

    Expert Comment

    by:Ray Paseur
    Here is a trick that might work (I design my sites so it will work, but I cannot vouch for Mambo).

    Add ob_start() to the top of the index.php script.
    Add $htm = ob_get_contents() to the end of the PHP script.
    Add file_put_contents('index.html', $htm); right after ob_get_contents.

    This should capture the browser output of the PHP page and write it into the static page.  
    LVL 107

    Accepted Solution

    BTW, there are server settings that determine the cascade of "home page" script names.  Usually this goes something like...


    So if you insert an index.html file into the web root that should be found first.  However this list is not immutable so be on the lookout for a change in the order of the pages.  I cannot remember where to find this, but maybe one of the other experts will weigh in.

    best regards, ~Ray

    Author Comment

    Many thanks for the replies.

    I intended to make the html holding page just a blank page with a short message and not similar to the site itself in any way - I assume that this will be ok without any change of code (apart from the rename and the index.html page inserting)...?
    LVL 107

    Expert Comment

    by:Ray Paseur
    You might not have to rename anything.  If the cascade of page URLs is like I am guessing, you will be OK just adding index.html

    But I always back everything up first ;-)
    LVL 4

    Assisted Solution

    Depending on your settings u could put a index.html in your root and your server will take it before the .php file. If the user opens the page als / (not linking to the index.php file directly. Better is to put there a index.php file with HTML code.

    What is easiest is up to you (depends on your level of access), and if u urself want to be able to acces the site. I can do no harm to rename the index.php (but it is possible that the page does not work in the new name and u have to change it back in order to use it again in the old way).

    Even better would be to take offline the site and put a temp site online but again this depends on your needs / abilities. (so let the webserver point to a other folder with the temp site)

    Author Closing Comment

    Thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now