How do I redirect HTTP to HTTPS on browsers?

When someone types in my Wordpress site without explicitly including the https part (just mysite.com) it automatically goes to http://<mysite.com></mysite.com>

It doesn't redirect to https://<mysite.com> within the browser (Firefox, Chrome, Pale Moon).</mysite.com>

I am already set up with SSL internally. My WordPress is using HTTPS (I have it forced.) I changed both my .htaccess and wp-config.php to reflect this. Also I changed the WordPress Address and Site Address under WordPress's Settings->General to https://<mysite.com>. This is all for within WordPress. If I'm visiting with any modern browser, I think Apache's settings on my Web site override WordPress when port 80 or port 443 traffic is displayed in the browser?</mysite.com>

So I think the problem here is Apache? Or is it WordPress? I've already tried changing my <mysite.com>.conf Apache file and .htaccess, to no avail. Why do browsers automatically go to http://<mysite.com> while my wordpress is running? Maybe it's Linode or my A/AAAA Record? (domain settings)</mysite.com></mysite.com>

3 Replies

This is a server issue. It has nothing to do with WP or DNS.

See:

https://linuxize.com/post/redirect-http-to-https-in-apache/

Also, don’t forget to blow your browser cache before trying what’s recommended in this article.

— sw

Thanks. I tried the suggested code for my port 443 entry in <mysite.com>.conf.</mysite.com>

Apache complained about "too many redirects" - the site wouldn't load. So I guess I didn't enter the code correctly or it's something somewhere else.

Did you blow your browser cache (a couple of times) and clean out all the cookies cached in your browser before you tried it? This could also be a problem with plugins you may use. See:

You can also do this with php(1) and apache2 mod_rewrite. See:

https://thisinterestsme.com/php-forcing-https-over-http/

Again, you're going to have to blow your browser cache and delete all your cookies before trying any of these. It would probably be helpful to blow your server's cache too:

http://httpd.apache.org/docs/2.4/programs/htcacheclean.html

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct