Skip to content

Instantly share code, notes, and snippets.

@lunule
Created November 16, 2023 16:40
Show Gist options
  • Save lunule/b4df27d84a28f338c30daba1e4e534a3 to your computer and use it in GitHub Desktop.
Save lunule/b4df27d84a28f338c30daba1e4e534a3 to your computer and use it in GitHub Desktop.
[WordPress - Force SSL Without a Plugin] #wordpress #core #force #ssl

in .htaccess, right before the # END WordPress line

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

in wp-config.php

define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] );
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment