Create your maintenance page with PHP

With maintenance page created, it is very helpful for a web programmer to perform the maintenance and other task if it is needed.

Actually it is very easy to create maintenance page for a PHP script, all you need is create a simple maintenance page with image or meaningful word with maintenance.html and php script with maintenance.php.

I will not going to teach you to create the maintenance.html where you may just put it as “Domain.com is under maintenance” or whatever.

Today, I will guide you the script of the maintenance function in maintenance.php.

==================
<?php
function maintenance($mode = FALSE){
if($mode){
header(“Location: http://mickgenie.com/maintenance.php”);
exit;
}else{
header(“Location: http://mickgenie.com/”);
exit;
}
}
?>

==================

Go to your index.php or any other index handler page, add this to the line just after the PHP open tag.
require_once(“maintenance.php”);

Then, if you wish to enter maintenance mode, just add the following line after the require_once line.
maintenance(TRUE);

All in one redirect scripting

HTML redirect:

For most of the webmaster, they will prefer 301 Redirect. With HTML redirect with HTML, I will suggest canonical type.

You may use the following script from the HTML with canonical redirection.

<link rel="canonical" href="http://www.mickgenie.com/" />

htaccess with mod_rewrite redirect:

If you are using Apache or Mod_Rewrite enabled Web services, htaccess with mod_rewrite redirect is very useful, you may use the following script to perform your redirection.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mickgenie.com
RewriteRule (.*) http://www.mickgenie.com/$1 [R=301,L]

ColdFusion Redirect:

Sample code for Cold Fusion.

<cfheader name="Location" value="http://www.mickgenie.com/">

PHP Redirect:

Sample code for PHP.

<?php
header("location:http://www.mickgenie.com");
exit;
?>

ASP Redirect:

Sample Code for ASP.

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mickgenie.com/"
%>

ASP.Net Redirect:

Sample Code for ASP.Net.

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Location","http://www.mickgenie.com/");
}
</script>

Java Redirect:

Sample Code for Java.

<%
response.setHeader( "Location", "http://www.mickgenie.com/" );
response.setHeader( "Connection", "close" );
%>

Perl & CGI redirect:

Sample Code for Perl & CGI.

$q = new CGI;
print $q-› redirect(" http://www.mickgenie.com/ ");

Ruby & Ruby on Rails Redirect:

Sample code for Ruby & Ruby on Rails.

head :moved_permanently, :location =› "http://www.mickgenie.com/