I am posting this as a Dolphin 7 Tutorial. However, it's not Boonex Dolphin specific. It can be used with other scripts at most hosting companies that use Apache web servers with mod_rewrite. I obviously can't test this with every possible combination of servers, browsers, and software out there. For the most part it is fairly simple and standard coding. It is kind of a Dolphin 7 Tutorial slash modification slash general web hosting and webmaster resource.

It shouldn't matter which Dolphin Version you use, or any other script for that matter as this involves .htaccess and .php files, but at the time I posted this tutorial the current version is: Dolphin 7.0.9

There are several different ways you can create a Maintenace Mode page for Boonex Dolphin. Some are more search engine friendly than others. I will show you the search engine friendly code I use to create a Maintenance Mode page that you can customize, which will be shown to your visitors in the event that you want to do maintenance on your site. You can also customize the page with your own personal message.

If you want to do maintenance and you don't want anyone else accessing your site or pages until you are done this might be what you have been searching for. You still have access to your site to make changes and updates, but nobody else will see what you are doing until you are done. They would see the maintenance page instead.

This tutorial assumes your website is installed in public_html/root/home/main (http://www.yoursite.com). Not in a subdomain or subfolder like (http://www.yoursite.com/test/). It also assumes that your host uses Apache web server with mod_rewrite enabled.

You need to add a small snippet of code to the main Dolphin .htaccess file and upload a simple .php file.

Step 1: Backup

Warning: Backup before proceeding
Since this does involve editing .htaccess it is very important to download a backup copy first. Htaccess files are extremely sensitive. Just one little character out of whack can and will make your entire site non-functional. If you copy and paste the wrong code, or miss part of it that's really all it takes. Download a backup so if this does happen you can simply upload the backup .htaccess file to your hosting account and try again.

Since this tutorial assumes your site is in public_html/root/home/main download and backup the following:

Don't say I didn't warn about downloading an .htaccess backup. Be sure to keep it in a handy easy to locate place on your computer.

Step 2: Download and edit pre-configured maintenance file

For the sake of keeping this easy to follow you are going to create a php page called maintenance.php. You can download and use the one I have created. It is a .zip file so you will need to extract it to your computer.
Download: maintenance.zip

Once you have it extracted open maintenance.php with notepad or some form of text editor.

This will be the page everyone will see once Maintenance Mode is enabled. Feel free to customize it to your needs.

Things you might change are:
<title>Maintenance Mode</title>
<h1>Maintenance Mode</h1>
<p><img src="path to your image"></p>
--<p><img src="http://www.yoursite.com/yourlogo.jpg"></p>
--<p><img src="http://www.yoursite.com/media/images/big_logo.png"></p>

You can change any text contained within the <body> and </body> tags. Standard html is allowed here.

If you change the message that says: Please try back in 60 minutes be sure you also change:
header('Retry-After: 3600');

3600 is 60 minutes. 1800 would be 30 minutes. 600 would be 10 minutes, and so forth.

So if you change it to say: Please try back in 30 minutes you would also change to:
header('Retry-After: 1800');

Once you are done save the changes and then upload maintenance.php to your hosting account so it is located here:

Important Note:
If you use an image be sure to use the full path including your domain name. Do not use a relative short path.

Correct way:

Wrong way:

Step 3: Edit .htaccess

Now open the .htaccess file on your server / hosting account with your preferred method such as an ftp client, or your hosts filemanager editor.

You are going to be adding a variation of the following code:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !/maintenance.php$
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|jpeg|js|png|swf|txt)$
RewriteRule $ /maintenance.php [R=503,L]
ErrorDocument 503 /maintenance.php

Before you add this to the .htaccess file you need to edit the RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123 to reflect your actual ip address. Otherwise, you won't be able to access your site either.

To find your ip address you can go to this site:

Once you go to whatismyip.com in the center of the page it will say: Your IP Address Is: (some number). For example, if it says your ip address is you would change:
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123

RewriteCond %{REMOTE_HOST} !^24\.111\.39\.204

And the entire code would look like this now:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !/maintenance.php$
RewriteCond %{REMOTE_HOST} !^24\.111\.39\.204
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|jpeg|js|png|swf|txt)$
RewriteRule $ /maintenance.php [R=503,L]
ErrorDocument 503 /maintenance.php

So now we copy that code and paste it into .htaccess (http://www.yoursite.com/.htaccess) and save the changes to the file in your hosting account.

Near the top of the .htacess file works well.

*Make sure you don't have an ErrorDocument 503 command already in your .htaccess file. If so you can comment it out like this:
#ErrorDocument 503 /503.shtml

As mentioned earlier your hosting server needs to have mod_rewrite enabled for this to work. Most hosting companies do, but not all of them.

If your ip changes you would need to update it with your new ip address.

You can test this by temporarily changing the ip address line to also block yourself and then visit your site to see what others would see like so:
RewriteCond %{REMOTE_HOST} !^2\.111\.39\.204

Both the ReWriteRule [R=503,L] and the maintenance.php contain (503 code) Service Temporarily Unavailable, which tells search engines like Googlebot to try the pages again later rather than to index the "down for maintenance" page?

The RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|jpeg|js|png|swf|txt)$ line allows search engines to access these types of files while you perform maintenance.

Turning if off:

To turn it off or disable it you can just comment each line out in your .htaccess file by placing a (#) in front of each line like:
#Options +FollowSymlinks
#RewriteEngine on
#RewriteBase /
#RewriteCond %{REQUEST_URI} !/maintenance.php$
#RewriteCond %{REMOTE_HOST} !^24\.111\.39\.204
#RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|jpeg|js|png|swf|txt)$
#RewriteRule $ /maintenance.php [R=503,L]
#ErrorDocument 503 /maintenance.php

If you want to turn it back on to do more maintenance you would just remove the (#'s) again. Be sure to make sure your ip address hasn't changed. If so you will need to update the REMOTE_HOST line with your new ip address.


Apache seems to prefer or recommend using REMOTE_HOST:
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123

However, I do see REMOTE_ADDR used on some occasions:
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123

I am using the REMOTE_HOST version since it is what Apache references. You may try REMOT_ADDR version if you want.


Here is an example of a plain old default 503 error message:
Plain default 503 error message

Here is a screen shot using the included code provided in maintenance.php (Just add your image.)
Maintenance Mode

Here is a screen shot example after customizing maintenance.php:
Edited Mainenance Mode

The Maintenance Mode page will also be displayed any time your server or host has a 503 error. Some common causes are: server capacity, too many connections, etc.

So if your host or account is having any of these issues visitors will see the maintenance page rather than a default 503 error page. If this happened to be the case at least your visitors wouldn't know your server is having problems. They would simply think that you were actually performing maintenance and they would check back later.

This in not Boonex Dolphin specific either. You should be able to use this with just about any website on a Apache websever with mod_rewrite.

Apache Reference Links:
Send everyone except the developer a 503
503 Header with PHP

Other Boonex Dolphin Tutorials your might be interested in:
Create a Custom 404 Error Page
Dolphin 7 404.html Page Not Found

Written By
Tutorial by: Jeremy LeSarge (AKA Ray)

I am the owner and administrator of DialMe.com. I write Tutorials for Boonex Dolphin as well as tips and resources surrounding website programming and development. I enjoy working with WordPress, SEO, and Web Hosting / Servers. I also maintain a WordPress Blog here on this site where you will find a variety of technology and webmaster resources.

Sponsored Links