Jump to content

Redirect URL on Maintenance page


Recommended Posts

Hi Guys

 

I would like to redirect customers to my other website while my new site is under construction.

How do I add an url to my other site on the page that show Under maintenance?

 

Link to comment
Share on other sites

You can add a simple redirection in the file:

/classes/controller/FrontController.php

Search for a code similar to this:

/* Display a maintenance page if shop is closed */
protected function displayMaintenancePage()
{
if ($this->maintenance == true || !(int)Configuration::get('PS_SHOP_ENABLE'))
{
  $this->maintenance = true;
  if (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))
  {
   header('HTTP/1.1 503 temporarily overloaded');

And add:

Tools::redirect('https://www.google.com/');

After the line:

header('HTTP/1.1 503 temporarily overloaded');

Final code should looks like this:

/* Display a maintenance page if shop is closed */
protected function displayMaintenancePage()
{
if ($this->maintenance == true || !(int)Configuration::get('PS_SHOP_ENABLE'))
{
  $this->maintenance = true;
  if (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))
  {
   header('HTTP/1.1 503 temporarily overloaded');
   Tools::redirect('https://www.google.com/');

Of course you need change the URL

  • Like 1
Link to comment
Share on other sites

  • 10 months later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...