最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Vercel 301 redirection works only on http requests. https requests return 200 status. How can I apply the redirection to https r

programmeradmin0浏览0评论

I'm building my own website and for SEO reasons I need to redirect all traffic from www.example to example.

To achieve this, I created a vercel.json file and added it to the root directory of my project with the following content:

{
  "redirects": [
    {
      "source": "/(.*)",
      "has": [
        {
          "type": "host",
          "value": "www.example"
        }
      ],
      "destination": "/$1",
      "statusCode": 301
    }
  ]
}

After deploying this configuration and waiting a few hours, it started working for HTTP traffic: now correctly issues a 301 redirect to .

However, HTTPS requests to still return a 200 status code, serving the site content instead of redirecting. Since most browsers and search engines use HTTPS by default, this is causing serious SEO problems due to duplicate content.

I’ve confirmed this behavior using curl, DevTools, and httpstatus.io. There is no Location header, and the status remains 200.

I’d really appreciate your help in figuring out how to apply the 301 redirect over HTTPS as well. Is there anything else I need to configure, or does this need to be enforced from the infrastructure of the hosting provider?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论