Jump to content

[Résolu] - [Tips] Amélioration du mode "maintenance"


Recommended Posts

Oops. C'est encore moi  ???

 

Pour éviter l'indexation involontaire des robots (moteurs de recherches), je me suis permis d'injecter un header 503 (site indisponible)

 

Fichier /root/header.php :

 

[pre]if (basename($_SERVER['PHP_SELF']) != 'disabled.php' AND !intval(Configuration::get('PS_SHOP_ENABLE')))

{

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

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title></title>

<link href="css/maintenance.css" rel="stylesheet" type="text/css" />

</head>

<body>';

echo '<div id="maintenance">

<p><img src="img/logo.jpg" alt="logo" /><br /><br /></p>

<p id="message">

<img src="img/admin/tab-tools.gif" style="margin-right:10px; float:left;" alt="" />Notre boutique est temporairement indisponible pour cause de maintenance. Nous vous prions de nous excuser pour la gêne occasionnée ; et nous vous demandons de renouveller votre visite dans les prochaines heures. <br /><br />

In order to perform site maintenance, our online shop has been taken offline temporarily. We apologize for the inconvenience, and ask that you please try again later !

</p>

</div>

</body>

</html>';

exit;

}[/pre]

 

Ce header type 503 précise aux moteurs de revenir plus tard pour une nouvelle indexation et préserve du même coup l'indexation déjà effectuée - sans modification.

 

Au passage, vous constaterez que j'externalise les styles css, dans un fichier nommé "maintenance.css" situé dans /root/css :

 

[pre]*, body{margin:0;padding:0}

body{font:90%/1em 'Lucida Grande', Verdana, sans-serif;}

#maintenance{

width:450px;

margin:35px auto 0 auto;

padding:12px 0;

border-top:1px dotted #666;

border-bottom:1px dotted #666;

background:#fff;

text-align:center;

text-transform:none;

font-weight:normal;

letter-spacing:0;

color: #C73178;

}

#message{

width:450px;

margin-top:35px;

padding:12px 15px;

border-top:1px dotted #666;

border-bottom:1px dotted #666;

background:#F9E3EE;

text-align:left;

font-family:90%/1em 'Lucida Grande', Verdana, sans-serif;

text-transform:none;

font-weight:normal;

letter-spacing:0;

color:#C73178;

height:140px;

}

#message img{padding:30px;clear:right}[/pre]

 

Voilà. Si cela peut intéresser quelqu'un  :)

 

Cordialement,

Patrick.

Link to comment
Share on other sites

J'ai refait la page de maintenance en l'incluant directement dans le thème par défaut.

On peux d'ailleurs désormais traduire le message directement via l'outil du back-office.

 

J'ai aussi rajouté le header 503, et géré correctement le code de langue par rapport au cookie.

Le tout en tpl ;)

 

Donc là c'est niquel pour la prochaine version :)

 

Merci en tout cas pour ce tips très intéressant, surtout le header !

Link to comment
Share on other sites

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...