最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

multisite - Htaccess file isn't redirecting http sub-pages to https––they display 404 error instead, tried many solution

programmeradmin0浏览0评论

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:

(will redirect properly to https)
/ (won't redirect to https and instead shows 404 error)
/ (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.

(redirects properly to https)

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论