ISPConfig3 eigene Default Index und Error Seiten

Um individuelle Index.html und oder Error-Seiten? für neu angelegte Internetseiten hinterlegen ist dies ganz einfach.

index.html

Erstelle eine Datei unter /usr/local/ispconfig/server/conf-custom/index/ namens standard_index.html

root

touch /usr/local/ispconfig/server/conf-custom/index/standard_index.html
chmod 750 /usr/local/ispconfig/server/conf-custom/index/standard_index.html
chown ispconfig:ispconfig /usr/local/ispconfig/server/conf-custom/index/standard_index.html

Befülle die soeben erstellte Seite mit Deinem Willkommens Inhalt.
Wenn die Index-Seite für alle Sprachen (die Sprache die beim Client hinterlegt ist) gleich sein soll bist Du fertig. wenn Du für jede Sprache eine eigene erstellen möchtest, erstelle eine weitere Index-Seite mit dem Länderkürzel hinten dran. Zum Beispiel für Deutschland:

root

touch /usr/local/ispconfig/server/conf-custom/index/standard_index.html_de
chmod 750 /usr/local/ispconfig/server/conf-custom/index/standard_index.html_de
chown ispconfig:ispconfig /usr/local/ispconfig/server/conf-custom/index/standard_index.html_de

Wenn jetzt eine neue Internet-Seite angelegt wird wird geprüft ob die Sprache des Clienten vorhanden ist, und es wird diese als index.html gespeichert. wenn nicht wird die standard_index.html kopiert.

Error-Seiten

In dem Ordner /local/ispconfig/server/conf-custom/error
sind folgende Dateien (gleicher chmod und chown wie index) anzuelegen.

  • 400.html
  • 401.html
  • 403.html
  • 404.html
  • 405.html
  • 500.html
  • 503.html

das sind die standard Dateien wenn es keine Sprache gibt. Für jede Sprache ist dann ein ORDNER mit diesen Dateien Anzulegen. Zum Beispiel für Deutschland
mkdir -p /local/ispconfig/server/conf-custom/error/de und dann noch die error.html-Dateien anlegen. Fertig.
Du kannst auch den Innhalt von /local/ispconfig/server/conf/error/ bzw. /local/ispconfig/server/conf/index/ in den Ordner conf-custom kopieren und dann die Anpassungen vornehmen.

Wo wird das im code beahndelt?

/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php
ab Zeilen 396

// Copy the error pages
if($data["new"]["errordocs"]) {
$error_page_path = escapeshellcmd($data["new"]["document_root"])."/web/error/";
if (file_exists("/usr/local/ispconfig/server/conf-custom/error/".substr(escapeshellcmd($conf["language"]),0,2))) {
exec("cp /usr/local/ispconfig/server/conf-custom/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path);
}
else {
if (file_exists("/usr/local/ispconfig/server/conf-custom/error/400.html")) {
exec("cp /usr/local/ispconfig/server/conf-custom/error/*.html ".$error_page_path);
}
else {
exec("cp /usr/local/ispconfig/server/conf/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path);
} }
exec("chmod -R a+r ".$error_page_path);
} // copy the standard index page
if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))) {
exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
}
else {
if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")) {
exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
} else {
exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
if(is_file('/usr/local/ispconfig/server/conf/index/favicon.ico')) exec("cp /usr/local/ispconfig/server/conf/index/favicon.ico ".escapeshellcmd($data["new"]["document_root"])."/web/");
if(is_file('/usr/local/ispconfig/server/conf/index/robots.txt')) exec("cp /usr/local/ispconfig/server/conf/index/robots.txt ".escapeshellcmd($data["new"]["document_root"])."/web/");
if(is_file('/usr/local/ispconfig/server/conf/index/.htaccess')) exec("cp /usr/local/ispconfig/server/conf/index/.htaccess ".escapeshellcmd($data["new"]["document_root"])."/web/");
}
}