Filip Kasaj

“inner strength as space”

User Tools

Site Tools


technet:dokuwikihttpsredirect

This is an old revision of the document!


If redirect from http to https is need and there is no success via .htaccess then PHP can help us:

'…lib/tpl/template-name/main.php'

if ($_SERVER['HTTP_HOST'] != 'localhost' and $_SERVER['HTTP_X_FORWARDED_PROTO'] != “https”) {

  $location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  header('HTTP/1.1 301 Moved Permanently');
  header('Location: ' . $location);
  exit;

}

Inspired by https://www.dokuwiki.org/tips:httpslogin

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
technet/dokuwikihttpsredirect.1686731111.txt.gz · Last modified: 2023/06/14 10:25 by fk