Htaccess file isn’t redirecting http sub-pages to https––they display 404 error instead, tried many solutions and none work

Question

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)

0
, , , , Ben Ballinger 2 years 2020-08-12T20:10:18-05:00 0 Answers 48 views 0

Leave an answer

Browse
Browse