Migrating from HTTP to HTTPS: Fixing Mixed Content and Forcing Secure Protocol
After purchasing and installing an SSL certificate, migrating your website from HTTP to HTTPS is essential to build visitor trust and improve Google rankings.
Mixed Content Issue
If the green padlock appears only briefly when accessing your site via HTTPS and then turns gray, it means that the page contains insecure http://
elements (images, internal links, scripts, stylesheets, etc.).
Browsers such as Firefox can help identify insecure links, making them easier to correct.
How to fix
- Update all internal links (pointing to your own site) from
http://
tohttps://
. - Perform a search-and-replace in your database, paying close attention to serialized fields that may break if modified incorrectly.
- Check your CMS documentation (WordPress, Joomla, etc.) or e-commerce platform: many provide plugins that simplify the migration.
Forcing HTTPS
Once all links are corrected and the padlock is fully green, you can enforce HTTPS for all visitors using the .htaccess
file.
Add the following rules to your site’s root directory:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Replace yourdomain.com
with your actual domain name.
Note
Always review your CMS documentation before editing .htaccess
. A misconfiguration may prevent your site from loading correctly.