1

I installed SSL on my Google Compute Engine hosted WordPress Multisite installation, and have been having a hard time getting it working fully. Right now, the main domains for each site redirect properly to their https version, and the sites show that they're secure, so they seems to be configured correctly. All links/images/etc use dynamic URLs so they're also updated fine.

However, if I directly visit a sub page of the site in http form, it won't redirect to the https and instead shows a 404 error. If i manually add the https into the url, it loads correctly, but otherwise it just shows a 404 error.

I have poured over StackOverflow and StackExchange and tried probably 20 different solutions, and none of them work. Most recently I tried the following:

# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>

# END WordPress

Unfortunately it's not working. You can see an example of what I mean here:

http://polararealty.com (will redirect properly to https)
http://polararealty.com/listings/ (won't redirect to https and instead shows 404 error)
https://polararealty.com/listings/ (shows correct page that the above should be redirecting to)

EDIT 8/18/2020

Bizarrely, urls pointing to areas on the admin panel all will redirect properly--just not the front-end website.

e.g.

http://polaragroup.com/wp-admin (redirects properly to https)

4
  • The HTTP to HTTPS redirect directive in your .htaccess file isn't doing anything. If you look at the network traffic in the browser it would seem that WordPress is redirecting the domain root. However, it seems odd that requesting other HTTP URLs return 404s? And not WordPress 404s, but Apache default 404s. This implies that (other?) HTTP requests are not even reaching your "Google Compute Engine" instance? Commented Aug 13, 2020 at 1:10
  • That makes sense, but how do I fix it? Commented Aug 13, 2020 at 16:01
  • Not sure, that was just an observation. This doesn't really look like a WordPress question, but rather a "Google Compute Engine" question - where is http://example.com/<something> ending up? It doesn't appear to be reaching your site at all? Commented Aug 13, 2020 at 16:08
  • Cross-site question posted on StackOverflow with accepted answer: stackoverflow.com/questions/63399424/… Commented Aug 20, 2020 at 0:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.