switch to https://
-
how can i change on (or all) of my sides to ssl? I can not change http:// to https://
-
Have you tried editing the URL in network admin and changing the scheme to https:// ?
thats the thing, i can not change the url its fixed to http:// and grey
What version of WP are you using?
I am using 4.2.5 with https://ww.wp.xz.cn/plugins/wordpress-mu-domain-mapping/
so nobody did this yet? Need to switch to http:// with SSL Certificate
Update to WP 4.4, then you can edit the scheme.
I feel stupid, just finally updated. However the main domain is still not editable. Only the other domains are, what am i missing? the domain name is grey and not editable!!
can i just add:
define('WP_HOME','https://example.com'); define('WP_SITEURL','https://example.com');to my wp-config? Or are all sides https than?
just strange, nobody ever had this problem? Nobody switching to SSL
Don’t do that, it won’t do anything for your sites in the network.
how can i change on (or all) of my sides to ssl? I can not change http:// to https://
Make a full backup of your database and files (it’s the DB that’s important) then using a search and replace utility modify all the HTTP urls to their HTTPS version.
Using WP-CLI it’s as easy as
wp search-replace http://url-here https://url-here --network --dry-runThe
--dry-runwill give you a count before actually doing it. If you are happy with the count then run the same command without the--dry-run.If something goes horrifically wrong then restore the database backup and you’ll be where you were before.
thanks Jan, i never used WP-CLI π
do you think a script like this could do the trick as well?
<?php // Database credentials $strHost = 'host'; $strUser = 'user'; $strPassword = 'password'; $strDatabase = 'database'; // From and to path $strFrom = 'http://'; $strTo = 'https://'; // DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING! error_reporting(E_ALL ^ E_NOTICE); function array_strpos($arrHaystack, $strNeedle) { foreach ($arrHaystack as $v) { if (is_object($v)) { $v = get_object_vars($v); } if (is_array($v) && array_strpos($v, $strNeedle) || !is_array($v) && strpos($v, $strNeedle) !== false) { return true; } } return false; } function array_str_replace($strSearch, $strReplace, $arrData) { foreach ($arrData as $k=>$v) { if (is_array($v)) { $arrData[$k] = array_str_replace($strSearch, $strReplace, $v); } elseif (is_string($v)) { $arrData[$k] = str_replace($strSearch, $strReplace, $v); } } return $arrData; } try { $db = new PDO ( 'mysql:dbname=' . $strDatabase . ';host=' . $strHost, $strUser, $strPassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'") ); $stmt = $db->query('SHOW TABLES'); $stmt->setFetchMode(PDO::FETCH_COLUMN, 0); foreach ($stmt as $strName) { $arrTables[] = $strName; } $intUpdates = 0; if (substr($strFrom, -1) == '/' && substr($strTo, -1) != '/') { $strTo .= '/'; } else if (substr($strFrom, -1) != '/' && substr($strTo, -1) == '/') { $strFrom .= '/'; } echo 'Searching tables' . "\n"; foreach ($arrTables as $strTable) { echo 'Processing ' . $strTable . "\n"; $stmt = $db->query(sprintf('SELECT * FROM <code>%s</code>', $strTable)); $stmt->setFetchMode(PDO::FETCH_ASSOC); foreach ($stmt as $row) { foreach ($row as $k=>$v) { $blnSerialized = false; $tmp = unserialize($v); if ($tmp !== false) { $blnSerialized = true; $v = $tmp; } if ($k != 'id') { $w = false; if (is_object($v)) { $v = get_object_vars($v); } if (is_array($v) && array_strpos($v, $strFrom) !== false) { $w = array_str_replace($strFrom, $strTo, $v); } if (!is_array($v) && strpos($v, $strFrom) !== false) { $w = str_replace($strFrom, $strTo, $v); } if ($w) { if ($blnSerialized) { $v = $row[$k]; $w = serialize($w); } $stmt = $db->prepare(sprintf('UPDATE <code>%s</code> SET <code>%s</code>=:value WHERE <code>id</code>=:id', $strTable, $k)); $stmt->bindValue('value', $w); $stmt->bindValue('id', $row['id']); $stmt->execute(); ++$intUpdates; } } } } } echo 'Update finished: ' . sprintf('%d rows updated', $intUpdates) . "\n"; } catch(PDOException $e) { var_dump($e->getMessage()); }*Looks. Cringes.*
It might but try this one instead.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
I say this three times:
- Back up your complete database and files and put them off of your server somewhere safe.
- Back up your complete database and files and put them off of your server somewhere safe.
- Back up your complete database and files and put them off of your server somewhere safe.
Did I mention backup? π
The page there has really good instructions and when you put that there make the directory something only you could know. Random characters and letters work.
Then perform your search and replace and test. If something goes wrong then you can restore the database.
Also? Be specific in what you are changing.
Don’t search and replace all
http:withhttps:that will break things. Instead be specific and change your own domains fromhttp://your-domaintohttps://your-domainone at a time.You can confirm that the HTTPS URL works before you do this. Visit
http://your-domain/readme.htmland confirm that the read me page loads. The do the same withhttps://your-domain/readme.htmland if that works you are good to go.thanks again, yep i know backup, backup, backup. I even duplicated my database and web folder.
should i than add
RewriteCond %{SERVER_PORT} !^443 RewriteRule ^(.*)$ https://ihredomain.tld/$1 [r=301,L]to my .htaccess?
That looks correct. If you have command line access try this curl command.
$ curl -I http://ihredomain.tld/ HTTP/1.1 301 Moved Permanently Location: https://ihredomain.tld/If the headers (that’s what
-Idoes) come backHTTP/1.1 301 Moved PermanentlyandLocation: https://ihredomain.tld/then you should be alright.
The topic ‘switch to https://’ is closed to new replies.