Https redirect - I don't know what I'm doing


#1

Hi all.

I’ve been with Dreamhost Shared for eight years, and I’ve been using Linux for nearly fifteen years, and I feel like the biggest moron on the planet because I have no idea how I don’t know this already, nor how none of the Google results make sense to me. I’m just a hobbyist when it comes to this, so I think I’ve somehow just missed this particular thing and have a gaping hole in my brain where https should live.

Anyway, I want my WordPress installs to be secure, as in https. Likewise my brand new owncloud installation. Everything https. really.

  • My Dreamhost webmail is https. It works fine.
  • I would swear my five year old installation of Wordpress was https until last year, but now it certainly isn’t now.
  • For my old WordPress install, my new installations of WordPress and for ownCloud when I put the S in the address bar I get a visit from this guy:
    http://cdn.web.horde.org/thumbnails/340x190/a/atomiclabs.com.png

When I Google that message, and when I search Dreamhost support for it, the results tell me DNS hasn’t worked. My hunch is this is not at all a DNS issue - with a http prefix it works fine.

The advice for hardening ownCloud in ownClouds own documentation suggests adding code to Apache configs, which I’m happy to do… but I have no memory of having to do that for WordPress or Webmail, so I’m not sure I actually need to do it for ownCloud. I think this is also barking up the wrong tree.

Edit: it appears that the Android app for ownCloud won’t connect to the installation unless it’s https, and as https doesn’t resolve the app won’t connect. This makes ownCloud… suboptimal, to say the least.

So my questions are:

  • have aliens stolen the part of my brain that makes me understand this?
  • how do I get https to work?
  • what else have aliens stolen from my brain in this time? Do I need tinfoil hats to save myself?

thanks in advance.


#2

This link might help you. https://help.dreamhost.com/hc/en-us/articles/215747758-How-do-I-force-my-site-to-load-securely-with-an-htaccess-file-


#3

Do you use the ‘www’ prefix? I suggest you drop it, as it simplifies things quite a bit.

Things to do after you fix .htaccess as mentioned above:

  1. Set up Secure Hosting for your WordPress site/domain
  2. If your owncloud setup is on a subdomain, like mine, you’ll need secure hosting for that subdomain as well.
  3. Set up WordPress (in WP Settings) to use the https url
  4. SSH in to your site and execute this command from your Wordpress directory: wp search-replace http://example.com https://example.com (it’ll change all your links, etc., from http to https.
  5. Dunno about ownCloud. I set mine up starting with https and don’t see a setting to force this. I use Cloudflare that rewrites https for everything.

Post back if you get hung up on anything along the way.

p.s. If you’re sore in your sitting area, aliens probably stole part of your brain. Sorry.


#4

Thanks a million to both of you. These things have solved most of the problem.

This one point was 99% of the problem.

I checked some old screencaps and I had previously had https for my main blog… then it wasn’t there anymore. I don’t know how this happened.

A few months ago I mailed DH support and asked why I could no longer get https access, and the reply was “Your DNS is broken, read the FAQ, also I noticed you don’t have an htaccess file, so made one for you.” When I replied that the DNS FAQ didn’t change anything and adding htaccess file didn’t work, I got another email saying I should check my DNS settings and by the way I didn’t have a htaccess file and that this different support worker had added one for me. At that point I gave up dealing with it and worked around it. Today I noticed the htaccess file that was handily created for me (twice) was empty.

So the aliens appear to have deleted my htaccess file at least twice, replaced it with an empty one, and possibly, somehow deselected ‘Secure Hosting’. Or maybe there was a wrinkle in my hosting somewhere there.

Either way, that’s now fixed. The .htaccess tweaks from that page has the redirection going swimmingly. Thanks again, friends.

ownCloud app still doesn’t work, but I’ll continue to work out what it’s problem is. I think it’s the app.

New Question: Lastly, I have six WordPress blogs going on the one domain and half of them are verified by Let’s Encrypt and the other half aren’t. Anyone know how that’s possible?

Thanks again for your help!


#5

What’s the URL structure for those six blogs? Something like: example.com/blog1, example.com/blog2, etc?
If so, make sure all six blogs are all configured to use https (steps 3 and 4 above).


#6

Hey, sorry about the two month delay. Personal life issues needed greater attention.

Re: structure - basically, yes.

Dumb question: when you say example.com in the above instructions, do you mean mydomainname.com, or actually example.com ? I ran wp search-replace http://example.com https://example.com and it returned a result saying Success: Made 0 replacements.

It didn’t seem unrealistic that WP uses example.com as a wildcard, so went with it.


#7

I mean search and replace for your actual domain name. You want to change all the http for your domain to https.