导致htaccess重定向问题的旧https [英] old https causing issues in htaccess redirect

查看:68
本文介绍了导致htaccess重定向问题的旧https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将旧站点URL重定向到新站点。

I am redirecting my old site URL to a new site.

我创建了一个htaccess,它将所有旧链接(root用户除外)重定向到添加了/ shop /目录的新路径。一切正常,但是所有流量都将使用旧的https,并且由于新的服务器帐户上没有SSL,因此抛出了证书错误。

I have created a htaccess that redirects all old links (except root) to new path with added /shop/ directory. It all works fine but the old https is what all traffic is going to and it is throwing a certificate error becuase there is not SSL on the new server account.

这里是

RewriteEngine on

RewriteCond %{HTTP_HOST} ^oldsite.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.oldsite.com [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule (.*)$ https://www.newsite.com/ [R=301,NC]

RewriteCond %{HTTP_HOST} ^oldsite.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.oldsite.com [NC]
RewriteRule ^(.*).(php|html)$ https://www.newsite.com/shop/$1.$2 [L,R=301,NC]

任何建议将不胜感激,谢谢您!

Any advice would be greatly appreciated, thank you in advance!

〜 M

推荐答案

无法使用.htaccess解决您的问题。如果您没有有效的https站点,则无法使用HTTP重写将HTTPS重定向到任何地方,因为客户端和服务器甚至需要开始使用HTTPS彼此对话,都需要SSL证书。
您应该为oldsite.com创建另一个虚拟主机来进行重定向(这些天您应该能够获得非常便宜甚至免费的SSL证书)。

There is no way to solve your problem using .htaccess. You can not use HTTP rewrite to redirect from HTTPS to anywhere if you don't have working https site, since SSL certificate is needed for client and server to even begin to talk to each other using HTTPS. You should create another virtual host for oldsite.com that will do the redirect (you should be able to get very cheap or even free SSL cert these days).

其他类似的答案:

如何在没有证书的情况下将HTTPS请求重定向到HTTP(Apache VirtualHosts)

如何在没有任何SSL证书的情况下将https重定向到http

https://serverfault.com/questions/429274/how-to-redirect-from-https-to-http-before-server-error

这篇关于导致htaccess重定向问题的旧https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆