0

My web-site is live on server. So many users visits daily on my live server.

So whatever the next developing module works on my local server. But when its development done and I will try to upload my local file data on live server then some user, Who is live on that time in my live site get programming error, because some file are still pending to upload.

In the above situation, I want to show some message on my site like that "Site under construction, Please visit after some time, Sorry for inconvenience".

I found this messages in many big site, but how can I achieve it, even I have lots of pages in my site and every URL redirect to site under construction page?

Thanks

Nilesh Dharmik
  • 349
  • 3
  • 13

2 Answers2

1

In your site you should have development and production mode in your code base. Basic idea is that as you know every request route through the index.php. If you set the mode to development at the index.php you should stop the code execute and set the above message. Otherwise you can continue the code execution. Use an if condition to check whether the site is is which mode.

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            //redirect or show the error message
        break;

        case 'testing':
        case 'production':
            error_reporting(0);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}
Techie
  • 44,706
  • 42
  • 157
  • 243
0

If your site isn't configured with a maintenance mode you can toggle, then setup a splash page with the message you want visitors to see and then switch the main page your url redirect is pointed to so it displays the under construction or maintenance message you want. Not complex at all.

Alternatively you could write a simple Javascript that toggles the message and displays it on your site's homepage if you don't want to go with the first suggestion.

Alex
  • 443
  • 3
  • 18