Skip to content

How to force SSL in WordPress admin interface

Method-1

If WordPress is installed to a SSL enabled web host, forcing SSL to the admin interface is quite simple.

Just add following line in to the main wordpress configuration file ‘wp-config.php‘:

define('FORCE_SSL_ADMIN', true);

Before the line

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
Method-2

The same result can be obtained by adding following code into  a ‘.htaccess’ file inside the ‘wp-admin’ directory or inside apache config file for the virtualhost containing the wordpress installation.


<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTPS} !=on
 RewriteRule ^(.*)$ https://www.example.com/wp-admin/$1 [L,R]
</IfModule>

Replace ‘www.example.com‘ with base-url of the WordPress installation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.