Change WordPress URL from HTTP to HTTPS

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:
Before: http://yourdomain.com/
After: https://yourdomain.com/ 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:
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/' ); Replace with this:
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' ); 🧠 How It Works — Step by Step
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.
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.
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.
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.
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.
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.
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.phpand 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.phpwithout 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
Installing SSL does not auto-update WordPress URLs — you must do it manually.
Edit WP_HOME and WP_SITEURL in wp-config.php and switch the scheme to https.
Re-upload the file, then verify under Settings » General in WordPress admin.
Add a 301 redirect from HTTP to HTTPS and resubmit your sitemap to Search Console.
❓ Frequently Asked Questions
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.WP_HOME and WP_SITEURL. Replace the http:// scheme with https:// in both define() lines and re-upload the file.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.
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.
12 people found this page helpful
