$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>404 error - How to convert multisite subdomain from http to https|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

404 error - How to convert multisite subdomain from http to https

matteradmin9PV0评论

I have created a WordPress multisite on the primary domain alaksns which is secure with ssl certificate. Then I added a new site as blog.alaksns which only works when accessed with http whenver I try to access it with https it gives a blankpage. I also tried by changing the url of the site from the network settings by adding https but it gives 404 error

I have created a WordPress multisite on the primary domain alaksns which is secure with ssl certificate. Then I added a new site as blog.alaksns which only works when accessed with http whenver I try to access it with https it gives a blankpage. I also tried by changing the url of the site from the network settings by adding https but it gives 404 error

Share Improve this question asked Feb 7, 2019 at 19:38 user160787user160787
Add a comment  | 

2 Answers 2

Reset to default 0

I like a simple, all-purpose htaccess to enable https on all site requests:

RewriteEngine On

RewriteCond %{HTTPS} !=on

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

In addition, go into Network Admin, Sites, then Edit each site, then the Settings tab for each site. Change all occurences of http to https for your site. (Some plugins may have the http, so changing them will get rid of the 'mixed' warning in browsers.)

Plus, you will need to change all media URLs on all sites. That's easiest with a search/replace plugin (I like "Better Search and Replace", but check the plugin you choose that it supports multisite) to change http://www.example to https://www.example (using your domain name).

Although the above htaccess might take care of http in plugins/themes/media/etc, I like a more complete process, so I change everything as needed. Backup your database first, of course.

I understand you would like to keep one site-ssl and the other one-non-ssl. Alotough I would recommend using ssl on both, try this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^blog\.alaksns\$ [NC]
RewriteCond %{HTTP_HOST} ^alaksns\ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
Post a comment

comment list (0)

  1. No comments so far