Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2019-06-06 07:31:28

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Maintenance page for Backlight (Solution)

Hi,

Here is the solution that I use to set up a maintenance page on Backlight:

--> First, create an HTML page named "maintenance.html" and add the following code:

<?php

header('HTTP/1.1 503 Service Temporarily Unavailable');

header('Status: 503 Service Temporarily Unavailable');

header('Retry-After: 3600');

header('X-Powered-By:');

?>
<!DOCTYPE html>
<!-- saved from url=(0067)https://mackeycreativelab.com/wp-content/uploads/2014/09/index.html -->
<html class="gr__mackeycreativelab_com"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
<title>Performing Maintenance</title>
<meta name="description" content="Performing maintenance...">
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon" />
    <!--[if gte IE 9]>
      <style type="text/css">
        .gradient {
           filter: none;
        }
      </style>
    <![endif]-->
<style type="text/css">
    /* Reset */
  html, body, div, span, applet, object, iframe,
  h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  a, abbr, acronym, address, big, cite, code,
  del, dfn, em, img, ins, kbd, q, s, samp,
  small, strike, strong, sub, sup, tt, var,
  b, u, i, center,
  dl, dt, dd, ol, ul, li,
  fieldset, form, label, legend,
  table, caption, tbody, tfoot, thead, tr, th, td,
  article, aside, canvas, details, embed, 
  figure, figcaption, footer, header, hgroup, 
  menu, nav, output, ruby, section, summary,
  time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
  }
  /* HTML5 display-role reset for older browsers */
  article, aside, details, figcaption, figure, 
  footer, header, hgroup, menu, nav, section {
    display: block;
  }
  html {
    height: 100%;
}
body {
height: 100%;
    margin: 0;
    background-repeat: no-repeat;
    background-attachment: fixed;
    /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#ed7827+0,e46f26+27,dd6226+70,d85d26+100 */
background: #ed7827; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPHJhZGlhbEdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzUlIj4KICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNlZDc4MjciIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIyNyUiIHN0b3AtY29sb3I9IiNlNDZmMjYiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSI3MCUiIHN0b3AtY29sb3I9IiNkZDYyMjYiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZDg1ZDI2IiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L3JhZGlhbEdyYWRpZW50PgogIDxyZWN0IHg9Ii01MCIgeT0iLTUwIiB3aWR0aD0iMTAxIiBoZWlnaHQ9IjEwMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-radial-gradient(center, ellipse cover,  #ed7827 0%, #e46f26 27%, #dd6226 70%, #d85d26 100%); /* FF3.6-15 */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#ed7827), color-stop(27%,#e46f26), color-stop(70%,#dd6226), color-stop(100%,#d85d26)); /* Chrome4-9,Safari4-5 */
background: -webkit-radial-gradient(center, ellipse cover,  #ed7827 0%,#e46f26 27%,#dd6226 70%,#d85d26 100%); /* Chrome10-25,Safari5.1-6 */
background: -o-radial-gradient(center, ellipse cover,  #ed7827 0%,#e46f26 27%,#dd6226 70%,#d85d26 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover,  #ed7827 0%,#e46f26 27%,#dd6226 70%,#d85d26 100%); /* IE10 preview */
background: radial-gradient(ellipse at center,  #ed7827 0%,#e46f26 27%,#dd6226 70%,#d85d26 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ed7827', endColorstr='#d85d26',GradientType=1 ); /* IE6-8 fallback on horizontal gradient */
  }
  ol, ul {
    list-style: none;
  }
  blockquote, q {
    quotes: none;
  }
  blockquote:before, blockquote:after,
  q:before, q:after {
    content: '';
    content: none;
  }
  table {
    border-collapse: collapse;
    border-spacing: 0;
  }
      
      html {font-size: 16px;}
      body { text-align: center; padding: 150px; }
      h1 { font-size: 40px; font-weight: bold; margin-bottom: 1rem;}
      p {font-size: 1.5rem; margin-bottom: 1rem;}
      body { font: 20px Helvetica, sans-serif; color: #fff; }
      #article { display: block; text-align: left; width: 650px; margin: 0 auto; }
      a { color: #26DDBE; text-decoration: none; }
      a:hover { color: #333; text-decoration: none; }
      div.a { font-size: 50px; font-weight: bold; margin-bottom: 50rem;  margin: 0; padding: 0; border: 0; vertical-align: baseline; text-align: left;}      
    </style>
</head>
<body data-gr-c-s-loaded="true">
<div id="article">
<div class="a">WEBSITE MAINTENANCE</div>
<br><br>
<h1>We&rsquo;ll be back soon!</h1>
<div>
<p>We apologize for the inconvenience, but we're performing some maintenance. You can still contact us at <a href="mailto:">email@domain.com</a>. We'll be back up soon!</p>
<p>— Business Name</p>
</div>
</div>
</body></html>

adapt the text as you wish according to your needs, and if you want to change the background color, so go to Ultimate CSS Gradient Generator
It’s just a basic page, you can make your own or take this one as a starting point.

--> Secondly, transfer this file "maintenance.html" by ftp to the root of your site (at the same level as .htaccess and index.php

--> Thirdly, add these lines of code to your file .htaccess:

	#Maintenance mode
	RewriteCond %{REQUEST_URI} !/maintenance.html$
	RewriteRule .* /maintenance.html [R=302,L]

Save, and now your maintenance page appears, everything is redirected to this page.

If you want to access your site to test, use this code and register your own IP address by replacing "255.25.25.25" by your IP adress  (Go here to Find your IP):

        #Maintenance mode
	RewriteCond %{REQUEST_URI} !/maintenance.html$
	RewriteCond %{REMOTE_ADDR} !255.25.25.25
	RewriteRule .* /maintenance.html [R=302,L]

--> Fourth, if you want all the galleries and direct url access to image etc... redirect to maintenance.html, you have to put this code in the .htaccess in the root subfolder "galleries" (or the name you gave him if you changed, this is the folder where all the albums are present):

RewriteOptions inherit

Save


--> Fourth, if you want Cart module and admin redirect to maintenance.html, you have to put this code in the .htaccess in the root subfolder "backlight":

RewriteOptions inherit

Save.

Note: if you want to access to your Backlight admin, you have to put your IP in the conditional filter at the third stage.

------------------------------------------------

Disable Maintenance mode:

Later, when you have finished maintaining your site, all you have to do is putting # in front of each line concerned in the .htaccess to disable Maintenance mode:

        #Maintenance mode
	#RewriteCond %{REQUEST_URI} !/maintenance.html$
	#RewriteCond %{REMOTE_ADDR} !255.25.25.25
	#RewriteRule .* /maintenance.html [R=302,L]

This has the effect of making these lines of code invisible and making access to your website normally.

That's it, I hope this tip can help you

Nico

Last edited by Nico3939 (2019-06-07 19:40:25)

Offline

#2 2019-06-06 08:21:04

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Maintenance page for Backlight (Solution)

Nice tip, Nico. Does it work if somebody visits a gallery directly via the address bar?

Offline

#3 2019-06-06 15:16:12

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Maintenance page for Backlight (Solution)

Arf! Well done Ben I have to update the code by adding a line...

Last edited by Nico3939 (2019-06-06 15:18:12)

Offline

#4 2019-06-06 15:59:58

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Maintenance page for Backlight (Solution)

It can also be interesting to add a HTTP 503 Service Unavailable code to signal to robots that this is only temporary and that this content is not the usual (for search engines, etc.). To add to the beginning of your target file (maintenance.html):

<?php

header('HTTP/1.1 503 Service Temporarily Unavailable');

header('Status: 503 Service Temporarily Unavailable');

header('Retry-After: 3600');

header('X-Powered-By:');

?>

Note: I have updated the first post to include this modification

Last edited by Nico3939 (2019-06-07 15:54:37)

Offline

#5 2019-06-06 19:32:28

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Maintenance page for Backlight (Solution)

Ben, it works with all page but not album or direct image if someone knows the direct link.

What’s the difference between page and album?

Offline

#6 2019-06-06 19:43:59

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Maintenance page for Backlight (Solution)

The difference is that pages are handled by the index.php file at the top of your site. Albums by he respective index.php files with the album's directory.

Offline

#7 2019-06-06 19:50:04

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Maintenance page for Backlight (Solution)

Ok I see

Thanks Ben

Offline

#8 2019-06-06 21:36:19

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Maintenance page for Backlight (Solution)

Ok, so that it works on all the site, including the pages, the albums and the images even in direct link, it is necessary to add this code to the file .htaccess of the directory "galleries" not the same as the .htaccess in the root:

RewriteOptions inherit

Note: I have updated the first post to include this modification

Offline

#9 2019-06-07 10:18:55

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Maintenance page for Backlight (Solution)

Good find.  Why are you using ob_start()?  I know what it does (prevents output being returned until either ob_end_flush() is called or the script ends), but I can't see any benefit in using it with the above files.

Offline

#10 2019-06-07 15:57:47

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Maintenance page for Backlight (Solution)

Yes Ben, you’re right, no need that. I have take this code from another of my websites so I have remove and update post.

So what do you think about the RewriteOptions Inherit in the « galleries » .htaccess file? Do you think that could be a problem?

For now, you could see the result on my website: https://phototheque.nicolaslogerot.com

Nico

Last edited by Nico3939 (2019-06-07 16:08:59)

Offline

Board footer

Powered by FluxBB