宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?

今天小白在通过谷歌查询一个站点的收录情况时,发现一个大问题。发现窜站了。比如 ,本来是www.abc.com,但是收录的结果却有大批量的,https://www.abc.com。而且这个站的内容跟同服务器一个开通了ssl的站点一模一样。等同于就是个镜像站。

宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?_图片 No.1

这对seo有利才见鬼了!不仅你这个站内容不匹配,同服务器的站点也因为多了个镜像站影响收录。

我开始一直没搞明白,以为是证书在哪里搞错了。结果发现,我这个站本身没有开启ssl功能。真到百度一搜索才知道原因。

这是宝塔程序默认存在的东西,类似于一个bug。宝塔的意思就是,要么你就所有站点都配置ssl证书,要么就就都不配置。
宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?_图片 No.2

但是这种现象肯定是不能避免的,有些站适合开通ssl,有些站没必要,那要怎么处理呢?

解决办法

1:添加一个新网站,域名随便,比如www.error.com,不需要可以访问,也不需要是备案了的,是个域名就行了

宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?_图片 No.3
2:配置ssl证书,随便找个就行,只有这台服务器配置了ssl证书才会出现这个问题,随便哪个配置过的域名的证书给这个www.error.com域名也可以

宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?_图片 No.4
这里提供一套过期的ssl证书:
key文件代码:

-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCiIroQaQR8gAcq
bLlAKxerLy+BzbB38tpv13Eqy6D1Bjhv12CrKiooQC59PBkc0XuRaDqYzeIKCdQT
RX+7EDJUujUfYomJzT5yLkTPRRor3cQ/WDAptzyd5MAjjx17SBKdl+gGuPWSQ7bf
LoxgIDZ6y7df644izZtD6SaO0DcEnenrMPa16QZUDX3RhgvWbkARwWa7MZzEtLNV
cOcXGEh2dsra3U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iRAw
VAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcC
ARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAz
MDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwu
Y3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsF
AAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo
uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/
wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu
X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG
PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6
KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==
-----END CERTIFICATE-----

3: 把www.error.com设置为默认站点

宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?_图片 No.5
4: 打开www.error.com目录,在index.html中输入下列代码

  1. <script>
  2.               location.href=location.href.replace(‘https’,’http’)
  3. </script>

这样你访问不存在的https网站就会跳转到http网站,如果要考虑SEO的话那最好是在服务端重定向

或者,直接将新站下面的index.html文件删除,这样https访问时,就会出现404页面。

未经允许不得转载:自学控 - 自己建站也轻松 » 宝塔窜站,未开启ssl的站点,通过https访问会跳转到同服务器开启了ssl的站点怎么解决?

分享到: 更多 (0)
avatar
自己建站,一点一滴积累经验。

评论 抢沙发

评论前必须登录!

立即登录   注册

自学控[zixuekong.com]

关于本站
切换注册

登录

忘记密码 ?

切换登录

注册