Thursday, May 31st, 2018
Forcing your website to use https:// instead of http:// has plenty of advantages, but there’s also quite a few steps that need to be taken to get that “green lock” on each page.
If you have URLS hardcoded in your database this can add on an additional tricky factor. Especially if it’s hundreds or thousands! So in order to update your links without much hassle a query can be ran via phpMyAdmin to update the links in your database columns that contain non-ssl links to ssl links.
UPDATE `TABLENAME` SET `COLUMNNAME` = REPLACE(
`TABLENAME`.`COLUMNNAME`,
“http://”,
“https://”
)
Editing your .htaccess file seems pretty easy, and it is…BUT if done incorrectly you can cause your entire website to not work AND can damage search engine rankings, so leave it to the professionals!
.htaccess PERMANENT 301 REDIRECT (add to existing .htaccess file). DO NOT USE unless you are 100% confident that you know what you’re doing! 🙂
RewriteCond %{HTTP_HOST} yourwebsite\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourwebsite.com/$1 [L,R=301]
Leave a Reply
You must be logged in to post a comment.