Author Topic: Changing all http: links in wysiwyg to https:  (Read 236 times)

Offline svsanchez

  • Posts: 449
Changing all http: links in wysiwyg to https:
« on: October 26, 2018, 07:44:53 AM »
Hello!

Is there a module for changing all the http://example.com to https://example.com inserted via Wysiwyg?

If not, how can I do this via phpMyAdmin?

Thank you!

Offline Ruud

  • Posts: 3640
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Changing all http: links in wysiwyg to https:
« Reply #1 on: October 26, 2018, 10:04:17 AM »
You can use a droplet to do this. It will not change the database, but it will change the output sent to the browser.
Untested droplet example:

Call it something like fixhttp
Code: (untested!) [Select]
<?php
// replace http://www.domain.com with https://www.domain.com

// The domainname 
$domain 'www.example.com';

// check src= and href= values using ' and "
$old[] = 'src="http://'.$domain$new[] = 'src="https://'.$domain;
$old[] = "src='http://".$domain$new[] = "src='https://".$domain;
$old[] = 'href="http://'.$domain$new[] = 'href="https://'.$domain;
$old[] = "href='http://".$domain$new[] = "href='https://".$domain;

// replace $old for $new
$wb_page_data str_replace($old$new$wb_page_data);

// tell the droplet engine it is ok
return true;
Call [[fixhttp]] in your template

Links created using the WB-LINK function in the WYSIWYG editors will always respect the WB_URL value in the config.php
Since WB 2.8.3SP3 (I think) the src= value for images in WYSIWYG should be using the same WB_URL value.
Note: this is only done for newly saved content after upgrading to these WB versions.


Offline svsanchez

  • Posts: 449
Re: Changing all http: links in wysiwyg to https:
« Reply #2 on: October 26, 2018, 08:47:40 PM »
Hello Ruud, your code didn't work (or I didn't know how to implement it). I placed it just after the BODY tag of my template and the page ceased to load.

BTW there seems to be a missing ?> at the end of your code, but it didn't work with it either.

Offline dbs

  • Betatester
  • **
  • Posts: 7553
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Changing all http: links in wysiwyg to https:
« Reply #3 on: October 26, 2018, 09:28:50 PM »
Quote
You can use a droplet to do this
Means, go to Admin-Tools > Droplets and create a new Droplet.

Offline svsanchez

  • Posts: 449
Re: Changing all http: links in wysiwyg to https:
« Reply #4 on: October 27, 2018, 09:25:56 PM »
Ok, but then it means I have to manually add the droplet to each page?

My website has more than 2,000 pages so manually opening each and every page to add the droplet is out of the question!

I need to change the http to https automatically on all the wysiwyg created pages!

Can I do that with this droplet (and how do I do apply to all the wysiwygs automatically)?

Offline dbs

  • Betatester
  • **
  • Posts: 7553
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Changing all http: links in wysiwyg to https:
« Reply #5 on: October 27, 2018, 10:14:01 PM »
Good places for global things are the footer in index.php of your template or in the Footer part of Settings.
Alternative: export your database and do a search-replace.

Offline jacobi22

  • Posts: 5201
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Changing all http: links in wysiwyg to https:
« Reply #6 on: October 28, 2018, 01:32:30 AM »
@ svsanchez: let us talk about some basic's...
if i remember correct, you use a older WB-Version and not one of the latest versions 2.11.x or 2.12.x?
and we talk about different link targets to different extern URL's?
or do you mean only intern links to subpages of your project?

some thoughts about the automatically replacement of every http (doesn't matter, which method (output filter, droplet, search and replace in database)) :
not every (extern) domain works with https and it's possible, that you get a 404, if you replace the http with https without test's - on the other side: nearly every domain with https has a redirect for not-https-request's

for intern links to subpages of your own project: wb use normalize wblinks for intern links and if you change your WB_URL in the config.php to https, all the WbLinks using also https

Probleme sind da, um sie zu lösen, nicht, um nach Ausreden zu suchen.

 

postern-length