I am unable to get my WordPress website to initially load without www and with https:// instead of http://.
I set the WordPress permalinks to “Post name”, so the url looks like “https://example.com/sample-post“. I also changed the “WordPress Address (URL)” and “Site Address (URL)” to “https://example.com“.
I added this to the wp-config.php:
define( 'FORCE_SSL_ADMIN', true );
Nothing works.
One thing I did that sort of worked was adding this to .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And it will initially load my website as www.example.com, then 3 seconds later change it to https://example.com. This seems like a weird hack.
What am I missing? How do I have my website initially load normally with https://
Add this to your .htaccess file