问题原文
原帖链接 · V3King · CC BY-SA 4.0
I have recently changed 3-4 of my sites to Cloudflare SSL. After that, I went to General Settings on WordPress and changed URLs from HTTP to HTTPS.
And it redirects from HTTP to HTTPS without any issues. But I read many posts on various blogs and they all mention adding .htaccess redirect.
Is that really necessary? I'm confused as the redirect is already in place.
社区高分解答
原帖链接 · DocRoot · CC BY-SA 4.0
It's really to do with when the redirect occurs.
WordPress/PHP naturally occurs later than .htaccess, so the HTTP request has already passed to PHP before the redirect occurs.
.htaccess is processed at the very start of the request, before it is passed to PHP.
However, if you are using CloudFlare then you should create a page rule to redirect HTTP to HTTPS to avoid unnecessary hits on your application server.
From a security point of view, you want to redirect to HTTPS as soon as possible.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
