Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Ron Rennick

    (@wpmuguru)

    Have you tried editing the URL in network admin and changing the scheme to https:// ?

    Thread Starter Kai Niermann

    (@joloshop)

    thats the thing, i can not change the url its fixed to http:// and grey

    Plugin Author Ron Rennick

    (@wpmuguru)

    What version of WP are you using?

    Thread Starter Kai Niermann

    (@joloshop)

    Thread Starter Kai Niermann

    (@joloshop)

    so nobody did this yet? Need to switch to http:// with SSL Certificate

    Plugin Author Ron Rennick

    (@wpmuguru)

    Update to WP 4.4, then you can edit the scheme.

    Thread Starter Kai Niermann

    (@joloshop)

    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

    (@joloshop)

    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

    (@joloshop)

    just strange, nobody ever had this problem? Nobody switching to SSL

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    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-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

    (@joloshop)

    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

    (@jdembowski)

    Forum Moderator and Brute Squad

    *Looks. Cringes.*

    It might but try this one instead.

    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

    (@jdembowski)

    Forum Moderator and Brute Squad

    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

    (@joloshop)

    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

    (@jdembowski)

    Forum Moderator and Brute Squad

    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)

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