从 https://www.domain 到 http://domain 的重定向规则如何?

how is the redirect rule from https://www.domain to http://domain?

这是 http 到 https
非 www 到 www

#http -> https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#add www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

我不知道反码^^;;
https 到 http
www 到非 www

htaccess 中的规则如何? 谢谢

要将 https 重定向到 http 并将 www 重定向到 non-www,您可以修改您的规则,如下所示:

RewriteEngine on
#https -> http
RewriteCond %{HTTPS} on
RewriteCond %{HTTP:X-Forwarded-Proto} !http$
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#add non-www.
RewriteCond %{HTTP_HOST} ^www\.(.+)  [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]