by
tmo » Thu Apr 20, 2017 11:19 am
As I've done this a number of times over the past year, I'll share what I've done:
• Set up your SSL cert and stuff with your host.
• Turn off caching for the time being in config.php
• Do a find and replace in all your template files / css files for any accidentally hardcoded URLS. Replace with <cms:show k_page_link /> <cms:show k_site_link /> if possible. Push those live, along with config.php.
• Spot check to make sure you didn't screw anything up so far. This will let you know that these changes aren't the problem if there are problems later.
• Go to phpmyadmin in your host and export the DB to your computer.
• Copy this file somewhere else just in case you screw everything up - I like a USB drive so I don't get anything confused.
• Rename the file you will be adjusting to "[sitename]-database-http-to-https-[date]" or something.
• Open this renamed file in your text editor
• Find and replace
http://site.com http://www.site.com and
https://site.com with
https://www.site.com (note: if you are not using www, then adjust). Be sure to replace it only what is necessary and don't **** up the trailing slash.

• Go back to phpmyadmin and export the db AGAIN. Backups will save your grace if something goes wrong.
• Go back to the browse section of phpmyadmin and drop your DB (That you have multiple backups of now). Don't drop any DB except the one you have backups of!
• Go to import in phpmyadmin and select your "[sitename]-database-http-to-https-[date]" file.
• Turn on / update your 1. define( 'K_SITE_URL', 'https://www.site.com/' ); in config.php
• Open an incognito window or different browser (301 redirects are heavily cached by browsers - moreso than your typical CSS file) and check to make sure everything is working. [/list]
If anything ISNT working:• first step is to make sure you are logged into Couch as superadmin and go save a few pages in the couch admin / backend.
• If you are getting "too many redirects" use a service like
http://www.redirect-checker.org/ to check the problematic URL. This ensures that it's a real issue and not a local-browser-caching-issue. (I spent 3 hours debugging a non-issue because my browser cached it in Chrome and Couch had cached something and I wasn't logged in incognito. >,< )
• Breath
• Check more things
• Drop the DB and replace with your backup, delete your edited DB file, and start over.
htaccess to enforce www / https (I'm no expert but this is the best combo that I've been able to find) - Code: Select all
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.site.com%{REQUEST_URI} [L,R=301]