Filip Kasaj

I can act how I want, but I can't want what I want.

User Tools

Site Tools


technet:dokuwikihttpsredirect

Dokuwiki redirect to https

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'

  1. if ($_SERVER['HTTP_HOST'] != 'localhost' and $_SERVER['HTTP_X_FORWARDED_PROTO'] != "https") {
  2. $location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  3. header('HTTP/1.1 301 Moved Permanently');
  4. header('Location: ' . $location);
  5. }

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.txt · Last modified: 2023/06/14 10:26 by fk