Categories
WordPress

Moving my WordPress to HTTPS for supporting HTTP/2-#2.

同一記事の日本語版

   Continued from this post. As I use Sub-directory type of WordPress multisite network, the steps of moving entire WordPress sites to HTTPS might be slightly different from single type cases.
   I used this opportunity to change some other things.

   First, I’ll write about some other things.

  1. I re-encoded all old videos on my sites because of adjusting to HTML5. And then, I removed my old flash player file(flvplayer.swf) from the plugins directory. I edited Root htaccess File of BPS for the flvplayer.swf.
    Actually, we don’t need flash players on web sites anymore, but most of sites still use flash players. Because if you have a lot of videos on your sites and their encode types are not supported by HTML5 video tag default, you have to re-encode them or customize something. Re-writing HTML source also takes time a little. I think the work takes significant time and money maybe. My sites has several videos only, but they took my time a day or so. Very bother.
  2. I’ve used a conf file of Apache for the access control of my server. But I stopped it and I am going to use a htaccess file for this purpose. To use htaccess for this purpose is more common use than to use a conf file.
    For this, I mean that I use require in the htaccess file, I added AuthConfig to AllowOverride directive.

   Now I’ll write about WordPress.

  1. I edited all http://o6asan.com/ in my sites to /. Of course, I can use //o6asan.com/ instead of /. But I think / is better than //o6asan.com/ because I don’t need to re-edit them even if I change my domain name someday.
    I used Search Regex for this. Most of them were replaced by this plugin, but the rest I had to replaced manually.
  2. I removed define(‘FORCE_SSL_ADMIN’, true); from my wp-config.php.
  3. I removed the following lines from my http-class.php because I don’t use self-signed certificate and client authentication at this time.
    curl_setopt( $handle, CURLOPT_SSLCERT, 'the exact path of clientcert.pem' );
    curl_setopt( $handle, CURLOPT_SSLKEY, 'the exact path of clientkey.pem' );
  4. This No.4 is most important for moving WordPress multisite network to HTTPS. Even if your WordPress is very new, you cannot avoid this step.
    If your WordPress is very new and is installed as on HTTPS, your main site has the URL like https://example.com. But if you want to move your WordPress network from HTTP to HTTPS like me, you have to change Site URL and HOME of your main site from your database. Of course, you need to log your SQL server in before this step.
    You can find Site URL and HOME values on the table wp-options. If you find them, replace http://example.com by https://example.com.

    About Child sites, you can change them from Network Admin’s Dashboard. Log on as Network Admin, go Sites page, and click Edit. On Info page, change Site URL to https://example.com or something like that, and on Settings page do same things for Siteurl, Home and Fileupload Url.

    You also need to change Fileupload Url about the main site.

    About Child sites, you need the above steps even if your WordPress is very new and is installed as on HTTPS. If you don’t, you will have some 404 from WordPress.

  5. Reboot Apache. Now my entire WordPress is on HTTPS.

Leave a Reply

Your email address will not be published. Required fields are marked *