Force HTTPS only for wp-admin

Last updated on June 26th, 2022 at 11:41 am

Installing an SSL certificate for your WordPress site is not enough to have all of your traffic secured and encrypted. Some of us prefer to force HTTPS for the entire site, while others want to secure just specific areas of their sites. Both scenarios are possible and most search engines will not penalize your SEO ranking if these were done correctly.

Still, there are many webmasters that don’t want to risk their site’s positions and prefer to stay on HTTPS. But in order to secure their admin logins, they have to implement an HTTPS strategy for their WordPress sites.

In order to do this, copy and paste the code in your site’s wp-config.php file as follows:

1. Login to your hosting account (our example is with GoDaddy shared hosting account).

2. Go to cPanel > File Manager. Open the folder of your site, locate the wp-config.php file, right click on it and select Edit.

3. Now paste the following code before That’s all, stop editing! Happy blogging so you can force HTTPS just for the wp-admin area:

define('FORCE_SSL_ADMIN', true);

Done!

Author: wpbackend

Content creator at wpbackend.com

Leave a Reply

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