Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
569 views
in Plugins by
I tried to secure the login and make Q&A more professionnaly but I couln't get it works by this ways. Thanks for you advices to make work the https login

1/

.htacess

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://website/login?to=/$1 [R,L]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://website.com/answers/register?to=/$1 [R,L]

 

do not work

 

2/ in config.php

define('FORCE_SSL_ADMIN', true);

if($_SERVER["REQUEST_URI"] == "/contact-us/" && $_SERVER["HTTPS"] != "on") {
        $newurl = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        header("Location: $newurl");
        echo $newurl;
        exit();
}

do not work

 

Thanks.

2 Answers

0 votes
by

.htacess

do work but all the folder go in https

+1 vote
by

I think the best way to do this in a Q2A friendly fashion is to put something like in a custom theme's qa-theme.php file:

function doctype()
{
  if (
    ( ($this->template=='login') || ($this->template=='register') ) &&
    (!qa_is_http_post()) &&
    (!qa_is_https_probably())
  ) {
    // your code to redirect to https page...
    exit;
  }

  qa_html_theme_base::doctype();
}

Code not tested, so please let me know of any problems.

by
Hi - I know this is an old post but there doesn't seem to be a lot of info on using https.
I've tried this solution and you can force https for those pages but once the user has been redirected, the rest of the site continues to use https rather than http.
...