# js代码实现http强制跳转到https全站重定向

*Published:* 2023-11-16
*Author:* 客服001

#### 温馨提醒

如果文章内容或图片资源失效，请留言反馈，我们会及时处理，谢谢

本文最后更新于2023年11月16日，已超过 180天没有更新



```
<script type="text/javascript">
var targetProtocol = "<a class="tag_link" href="https://www.xarjtc.com/tag/https" target="_blank" title="查看https此标签更多文章"><abbr title="">https</abbr></a>:";
if (window.location.protocol != targetProtocol)
 window.location.href = targetProtocol +
  window.location.href.substring(window.location.protocol.length);
</script>
```