WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.13.x) »
  • Modules »
  • How to successfully implement https [DROPLET]
  • Print
Pages: [1]   Go Down

Author Topic: How to successfully implement https [DROPLET]  (Read 9800 times)

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
How to successfully implement https [DROPLET]
« on: August 15, 2021, 10:28:44 AM »
Hello,

here is tutorial how to successfully implement https on your website. Today there are many ways to get free certificate and use https on your website.

So far known steps are:

In config.php instead

Code: [Select]
define('WB_URL', 'http://my-domain.com');
Change "http" to "https"
Code: [Select]
define('WB_URL', 'https://my-domain.com');

Also in .htaccess

Code: [Select]
RewriteEngine On
## Redirect from non-www to www , and change to https
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

In addition to this, make a droplet
Code: [Select]
global $wb;
$wb->preprocess($wb_page_data);
$url = WB_URL;
$url = preg_replace("(^https?://)", "", $url );
$wb_page_data = str_replace('http://'.$url, '//'.$url, $wb_page_data);
return true;

It will change all links that are manually inserted in modeules (and not via WB_URL variable) to https.

This way you will not get warning in browser warning "Conection not secure. Parts of this page are not secure (such as images)."

If there is a better way for this fell free to modify the code.



Logged
Web developer

Offline dbs

  • Betatester
  • **
  • Posts: 8914
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: How to successfully implement https [DROPLET]
« Reply #1 on: August 15, 2021, 10:34:22 AM »
Hi, this is the right way.
In the droplet or other modules you can remove the line
Code: [Select]
$wb->preprocess($wb_page_data);The line is outdated and without function.
Logged
https://onkel-franky.de

Offline EPFI

  • Posts: 2
Re: How to successfully implement https [DROPLET]
« Reply #2 on: November 24, 2021, 01:00:01 PM »
Hi,

We have company's web site implemented using Website baker. The issue is that site tries to load resources from unsecure side which causes mixed content errors in browser, see https://www.compressor.fi/ (doesn't work) vs http://www.compressor.fi/ (works). I'm new to this tool and couldn't find a place where these resource URI's are defined. Does anyone have an idea how this could be fixed?

I can not find correct path "config.php" which mentioned in the instructions



Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: How to successfully implement https [DROPLET]
« Reply #3 on: November 24, 2021, 01:48:02 PM »
config file is under root of your html folder
Logged
Web developer

Offline hgs

  • WebsiteBaker Org e.V.
  • **
  • Posts: 1883
    • EFG MG
Re: How to successfully implement https [DROPLET]
« Reply #4 on: November 24, 2021, 03:10:45 PM »
Two questions beforehand
Is there a valid certificate for the URL?
Is it linked to the URL?

I suspect that in the config.php the URL is entered in this form.
(Attention, no copy template!! I have masked the access data)

Quote
<?php
/*
 *** auto generated config file for 2.13.0
 *** WebsiteBaker 2.13.0
 *** created at 2021-05-30 12:23:09 Europe/Berlin
 */
// define('DEBUG', false);
define('DB_TYPE', 'mysqli');
define('DB_HOST', 'localhost');
define('DB_PORT', '3306');
define('DB_NAME', 'xxxxxxxxx');
define('DB_USERNAME', 'xxxxxxxx');
define('DB_PASSWORD', 'xxxxxxxxxxxxxxxx');
define('DB_CHARSET', 'utf8_unicode_ci');
define('TABLE_PREFIX', 'wb_');

define('WB_URL', 'http://www.compressor.fi); // no trailing slash or backslash!!
define('ADMIN_DIRECTORY', 'admin'); // no leading/trailing slash or backslash!! A simple directory name only!!

require __DIR__.'/framework/initialize.php';
// --- end of file ----------------------------------
This would have to be changed if the two questions were answered with yes.
The change, which are relevant for you, is shown "red" in the example
Quote
<?php
/*
 *** auto generated config file for 2.13.0
 *** WebsiteBaker 2.13.0
 *** created at 2021-05-30 12:23:09 Europe/Berlin
 */
// define('DEBUG', false);
define('DB_TYPE', 'mysqli');
define('DB_HOST', 'localhost');
define('DB_PORT', '3306');
define('DB_NAME', 'xxxxxxxxx');
define('DB_USERNAME', 'xxxxxxxx');
define('DB_PASSWORD', 'xxxxxxxxxxxxxxxx');
define('DB_CHARSET', 'utf8_unicode_ci');
define('TABLE_PREFIX', 'wb_');

define('WB_URL', 'https://www.compressor.fi); // no trailing slash or backslash!!
define('ADMIN_DIRECTORY', 'admin'); // no leading/trailing slash or backslash!! A simple directory name only!!

require __DIR__.'/framework/initialize.php';
// --- end of file ----------------------------------
Logged
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

"Never begin to stop - never stop beginning." Marcus Tullius Cicero (106-43 BC)

Offline EPFI

  • Posts: 2
Re: How to successfully implement https [DROPLET]
« Reply #5 on: November 25, 2021, 07:45:02 AM »
So I guess this (modifying config.php and .htaccess) is something that cannot be done using Website baker's web interface? I don't have access to the server at the moment.
Logged

Offline hgs

  • WebsiteBaker Org e.V.
  • **
  • Posts: 1883
    • EFG MG
Re: How to successfully implement https [DROPLET]
« Reply #6 on: November 25, 2021, 08:27:03 AM »
Correct, this is only possible via FTP access.
Logged
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

"Never begin to stop - never stop beginning." Marcus Tullius Cicero (106-43 BC)

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.13.x) »
  • Modules »
  • How to successfully implement https [DROPLET]
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2