Title: switch to https://
Last modified: August 30, 2016

---

# switch to https://

 *  Resolved [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/)
 * how can i change on (or all) of my sides to ssl? I can not change http:// to 
   https://
 * [https://wordpress.org/plugins/wordpress-mu-domain-mapping/](https://wordpress.org/plugins/wordpress-mu-domain-mapping/)

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/switch-to-https/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/switch-to-https/page/2/?output_format=md)

 *  Plugin Author [Ron Rennick](https://wordpress.org/support/users/wpmuguru/)
 * (@wpmuguru)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866181)
 * Have you tried editing the URL in network admin and changing the scheme to https://?
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866200)
 * thats the thing, i can not change the url its fixed to http:// and grey
 *  Plugin Author [Ron Rennick](https://wordpress.org/support/users/wpmuguru/)
 * (@wpmuguru)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866210)
 * What version of WP are you using?
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866211)
 * I am using 4.2.5 with [https://wordpress.org/plugins/wordpress-mu-domain-mapping/](https://wordpress.org/plugins/wordpress-mu-domain-mapping/)
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866302)
 * so nobody did this yet? Need to switch to http:// with SSL Certificate
 *  Plugin Author [Ron Rennick](https://wordpress.org/support/users/wpmuguru/)
 * (@wpmuguru)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866310)
 * Update to WP 4.4, then you can edit the scheme.
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866334)
 * 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!!
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866335)
 * 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?
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866354)
 * just strange, nobody ever had this problem? Nobody switching to SSL
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866355)
 * 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](http://wp-cli.org/) it’s as easy as
 *     ```
       wp search-replace http://url-here https://url-here --network --dry-run
       ```
   
 * The `--dry-run` will 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.
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866356)
 * 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());
       }
       ```
   
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866357)
 * _*Looks. Cringes.*_
 * It might but try this one instead.
 * [https://interconnectit.com/products/search-and-replace-for-wordpress-databases/](https://interconnectit.com/products/search-and-replace-for-wordpress-databases/)
 * I say this three times:
    1. Back up your complete database and files and put them off of your server somewhere
       safe.
    2. Back up your complete database and files and put them off of your server somewhere
       safe.
    3. 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.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866358)
 * Also? Be specific in what you are changing.
 * Don’t search and replace all `http:` with `https:` that will break things. Instead
   be specific and change your own domains from `http://your-domain` to `https://
   your-domain` one at a time.
 * You can confirm that the HTTPS URL works before you do this. Visit `http://your-
   domain/readme.html` and confirm that the read me page loads. The do the same 
   with `https://your-domain/readme.html` and if that works you are good to go.
 *  Thread Starter [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * (@joloshop)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866359)
 * 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?
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/#post-6866360)
 * 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 `-I` does) come back `HTTP/1.1 301 Moved Permanently`
   and `Location: https://ihredomain.tld/` then you should be alright.

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/switch-to-https/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/switch-to-https/page/2/?output_format=md)

The topic ‘switch to https://’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-mu-domain-mapping.svg)
 * [WordPress MU Domain Mapping](https://wordpress.org/plugins/wordpress-mu-domain-mapping/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-mu-domain-mapping/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-mu-domain-mapping/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-mu-domain-mapping/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-mu-domain-mapping/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-mu-domain-mapping/reviews/)

## Tags

 * [HTTPS](https://wordpress.org/support/topic-tag/https/)
 * [SSL](https://wordpress.org/support/topic-tag/ssl/)

 * 17 replies
 * 3 participants
 * Last reply from: [Kai Niermann](https://wordpress.org/support/users/joloshop/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/switch-to-https/page/2/#post-6866362)
 * Status: resolved