← ServerPilot Docs

How to Force SSL for the WordPress Dashboard

You can force SSL for only your WordPress Dashboard and administrator login page.

SFTP into your server as your WordPress app's system user and open your WordPress app's wp-config.php file.

Immediately before the line /* That's all, stop editing! Happy blogging. */, add the following:

define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
       $_SERVER['HTTPS']='on';
ServerPilot makes it easy for you to force SSL sitewide without needing to edit your .htaccesfile.
Last updated: March 9, 2020

Launch your first site in 5 minutes