Changing index.php to index.html

Posted on 2011-05-12
Medium Priority
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

ID: 35746685
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

hielo earned 400 total points
ID: 35746696
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 111

Expert Comment

by:Ray Paseur
ID: 35746772
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.  
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 111

Accepted Solution

Ray Paseur earned 800 total points
ID: 35746790
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

ID: 35746845
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 111

Expert Comment

by:Ray Paseur
ID: 35746873
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 ;-)

Assisted Solution

PimOnline earned 800 total points
ID: 35747012
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

ID: 35753292
Thank you

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month17 days, 7 hours left to enroll

864 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