无法使用 https 从 url 中删除 www

Trouble removing www from url with https

我想从 URL 中删除 www 但是,

我在使用 https (Apache Server) 从 url 中删除 www 时遇到问题。

我在 .htaccess 文件中添加了以下代码,它可以工作,但是当我转到 http://www.zubizi.com 时它不起作用,我需要为此做什么????

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://zubizi.com/ [R=301,L]

只需进行以下更改:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://zubizi.com/ [R=301,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]