Change WordPress URL from HTTP to HTTPS

Beginner
⏱️ 6 min read
📚 Updated: Aug 2025
🎯 2 Code Examples
SSL / Security

What You’ll Learn

How to switch your WordPress site’s WordPress Address (URL) and Site Address (URL) from http:// to https:// by editing wp-config.php.

After enabling HTTPS at the server level, WordPress will not move to HTTPS on its own. You’ll learn how to update WP_HOME and WP_SITEURL in two short steps so the entire site loads securely.

⭐ Before vs After

This is what changes inside your wp-config.php file when you flip the scheme:

Result
Before:  http://yourdomain.com/
After:   https://yourdomain.com/
1

Edit wp-config.php — Replace HTTP with HTTPS

Open wp-config.php in your favourite editor and locate the two define() lines for WP_HOME and WP_SITEURL. Change the scheme from http to https.

Find this:

wp-config.php
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/' );

Replace with this:

wp-config.php
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' );

🧠 How It Works — Step by Step

1

Connect to your server

Use FileZilla (or any SFTP client) to connect to your hosting/EC2 instance. The same flow works for GoDaddy, HostGator, Bluehost, and most other hosts.

SFTP
2

Locate wp-config.php

Find the file in your WordPress root directory. On a Bitnami EC2 setup it is usually at /bitnami/wordpress/wp-config.php.

Find file
3

Back up & open in a text editor

Make a backup copy of wp-config.php, then open the original in VS Code, Notepad++, or your preferred editor.

Backup & edit
4

Replace http with https

Locate the two define() lines for WP_HOME and WP_SITEURL, change 'http://' to 'https://' in both, then save the file.

Update scheme
=

Site loads over HTTPS

Upload the edited wp-config.php back to the server. Your WordPress Address and Site Address are now served over HTTPS with a green padlock in the browser.

2

Verify the Change in WordPress Admin

Once the file is back on the server, log in to /wp-admin and open Settings » General. Both fields should now show the HTTPS scheme. They will also be read-only because the values are pinned in wp-config.php.

Settings » General
WordPress Address (URL):  https://yourdomain.com   (defined in wp-config.php)
Site Address (URL):       https://yourdomain.com   (defined in wp-config.php)

💡 Tips for a Smooth Migration

Do This

  • Take a full backup of wp-config.php and the database first
  • Add a 301 redirect from HTTP to HTTPS in your web server config
  • Update internal links and image URLs that are hard-coded with http://
  • Resubmit the HTTPS sitemap in Google Search Console
  • Run a mixed-content check (e.g. Why No Padlock?) after the switch

Avoid

  • Editing wp-config.php without a backup
  • Changing only one of WP_HOME / WP_SITEURL
  • Leaving plugin or theme assets pointing to http://
  • Forgetting to renew the SSL certificate before it expires
  • Skipping the redirect — users will see duplicate HTTP/HTTPS pages

Key Takeaways

1

Installing SSL does not auto-update WordPress URLs — you must do it manually.

2

Edit WP_HOME and WP_SITEURL in wp-config.php and switch the scheme to https.

3

Re-upload the file, then verify under Settings » General in WordPress admin.

4

Add a 301 redirect from HTTP to HTTPS and resubmit your sitemap to Search Console.

❓ Frequently Asked Questions

WordPress stores the WordPress Address (URL) and Site Address (URL) in the database. Installing an SSL certificate only enables HTTPS at the server level — it does not rewrite values stored in WordPress, so you must update them manually.
wp-config.php lives in your WordPress root directory. On a Bitnami EC2 instance it is usually at /bitnami/wordpress/wp-config.php. On shared hosts (GoDaddy, HostGator, Bluehost) it sits next to the wp-content folder.
Update WP_HOME and WP_SITEURL. Replace the http:// scheme with https:// in both define() lines and re-upload the file.
HTTPS is a positive ranking signal. Just make sure to add 301 redirects from HTTP to HTTPS, update internal links, and resubmit your sitemap in Google Search Console.

Secure Your WordPress Site End-to-End!

From SSL setup to Search Console—explore more practical WordPress tutorials and lock down your site the right way.

All WordPress Guides →
Did you know?

Pinning WP_HOME and WP_SITEURL in wp-config.php not only switches the scheme—it also locks the URLs. The fields under Settings » General become read-only, which prevents accidental changes from the dashboard and is a small but valuable security win.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful