从https://example.com在htacess重定向到https://www.example.com重定向、example、https、com

2023-09-02 01:07:15 作者:partiality(偏心)

我与SSL进行www.example.com网站。我已成立了一个htaccess的重定向,它把从http://example.com => http://www.example.com用户。 如果我进入https://www.example.com那么它的工作原理。但是,如果我进入https://example.com然后它给了我一个SSL错误。

我如何重定向https://example.com到https://www.example.com而不显示SSL错误?

我用我的htaccess的重定向以下code。

 的RewriteCond%{HTTP_HOST}!^ WWW 。

(。*)重写规则^ $ HTTP://www.% {HTTP_HOST} / $ 1 [R = 301,L]
 

解决方案

这是关系到你的SSL设置,可能它不是(* .domain.com)设置如果是这样(www.domain.com)没有问题任何错误。

www.domain.com!= domain.com

Shopify URL优化需要注意的7大点

由于 WWW 的子域,即重定向到( domain.com ),那么,你需要启用SSL对( *。domain.com ),或者只是为( www.domain.com )所建议的@Jack

I have a website with the ssl for www.example.com. I have set up a htaccess redirect which redirects the user from http://example.com => http://www.example.com. If I enter https://www.example.com then it works. But if I enter https://example.com then it gives me a ssl error.

How do I redirect https://example.com to https://www.example.com without showing the ssl error?

I use the following code in my htaccess to redirect.

RewriteCond %{HTTP_HOST} !^www.

RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

解决方案

This is related to your SSL setup, probably its not set for (*.domain.com) if so (www.domain.com) doesn't issues any error.

www.domain.com != domain.com

Because www is subdomain, that redirected to (domain.com), then, you need to enable SSL for (*.domain.com) or just for (www.domain.com) as suggested by @Jack