Certbot with Apache: Difference between revisions
No edit summary |
|||
| Line 42: | Line 42: | ||
===WordPress Configuration=== | ===WordPress Configuration=== | ||
Make sure to change any HTTP references in the wp-config file ( define('WP_SITEURL', '<nowiki>https://'</nowiki> . $_SERVER['HTTP_HOST']);, *define('WP_HOME', '<nowiki>https://'</nowiki> . $_SERVER['HTTP_HOST']); ) or GUI (Word Press Address (URL), Site Address (URL) in General, Settings) to HTTPS | Make sure to change any HTTP references in the wp-config file ( define('WP_SITEURL', '<nowiki>https://'</nowiki> . $_SERVER['HTTP_HOST']);, *define('WP_HOME', '<nowiki>https://'</nowiki> . $_SERVER['HTTP_HOST']); ) or GUI (Word Press Address (URL), Site Address (URL) in General, Settings) to HTTPS. In MediaWIKI the http:// or https:// can be replaced with just // (two forward slashes) to accept both HTTP and HTTPS. How can that be done with WordPress? See below, thanks to [https://blog.rabin.io/sysadmin/make-wordpress-site-work-both-http-https RABIN];<syntaxhighlight lang="text"> | ||
function isSecure() { | |||
return | |||
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') | |||
|| $_SERVER['SERVER_PORT'] == 443; | |||
} | |||
WordPress makes it hard to switch from HTTP to HTTPS, so try this site to scan for issues: [https://www.whynopadlock.com/results/02d0cc06-1d61- https://www.whynopadlock.com/] | $web_site = 'www.lifeofthesaltonsea.com'; | ||
$schema = isSecure() ? 'https://' : 'http://'; | |||
$web_site_url = $schema . $web_site; | |||
define('WP_HOME', $web_site_url); | |||
define('WP_SITEURL', $web_site_url); | |||
define( 'FORCE_SSL_LOGIN', true ); | |||
define( 'FORCE_SSL_ADMIN', true ); | |||
</syntaxhighlight>WordPress makes it hard to switch from HTTP to HTTPS, so try this site to scan for issues: [https://www.whynopadlock.com/results/02d0cc06-1d61- https://www.whynopadlock.com/] | |||
WordPress Images (especially header images) are tough to change from HTTP to HTTPS, so plugins like this are useful: SSL Insecure Content Fixer (Please note, this plugin may produce a performance hit on websites) | WordPress Images (especially header images) are tough to change from HTTP to HTTPS, so plugins like this are useful: SSL Insecure Content Fixer (Please note, this plugin may produce a performance hit on websites) | ||