How to Fix Baidu’s “Redirect HTTP Site to HTTPS” Warning on Alibaba Cloud

By huanggs

Baidu’s message “Please redirect your HTTP site to the HTTPS site” usually means Baidu can still request the HTTP version and does not see a clean server-side redirect to the HTTPS version. On Alibaba Cloud, the fix depends on the product in front of the site: Cloud Web Hosting, ECS with NGINX/Apache, CDN, ALB, or a reverse proxy. Do not guess a console button until you know which layer receives port 80 traffic.

First confirm that HTTPS itself works

Before adding any redirect, open the HTTPS URL directly and confirm the certificate is valid for the exact host, including www versus non-www. If https://example.com/ has a certificate error, a 301 from HTTP to HTTPS will only send users and crawlers to a broken page.

Then test both versions with headers:

curl -I http://example.com/path?x=1
curl -I https://example.com/path?x=1

The HTTP response should be a server-side 301 to the matching HTTPS URL, and it should keep the path and query string unless you intentionally changed the URL structure.

If you use Alibaba Cloud Web Hosting

Read the exact edition limits first. The Alibaba Cloud Web Hosting redirect documentation describes domain-level 301 redirects and a “Support HTTPS Redirect” option for some editions. In that document, the HTTPS redirect option means HTTPS requests to the old source domain also participate in the old-domain to destination-domain redirect. It is not the same thing as a universal same-domain rule that forces http://example.com to https://example.com.

That matters because Cloud Web Hosting is not the same as an ECS server where you can freely edit NGINX or Apache. If the console only supports old-domain to new-domain redirects, do not force a same-domain rule that the product does not support. Use the hosting console options that match your edition, or ask Alibaba Cloud support whether protocol-level HTTP-to-HTTPS redirect is supported for your instance.

If you use Alibaba Cloud CDN or ALB

If Alibaba Cloud CDN is in front of the origin, enable protocol redirect at the CDN layer after the HTTPS certificate is configured. The Alibaba Cloud CDN HTTP/S redirection documentation states that HTTP-to-HTTPS redirection can be enabled at CDN POPs and uses 301 by default.

If an Application Load Balancer receives HTTP traffic, configure the HTTP listener to redirect to the HTTPS listener. The Alibaba Cloud ALB HTTP to HTTPS redirection documentation describes a path /* forwarding rule with action “Redirect To,” protocol HTTPS, port 443, and a status code such as 301.

Choose one main redirect layer. If CDN redirects to HTTPS and the origin also redirects based on the wrong scheme header, you can create loops. If you redirect at the origin behind a proxy, make sure the origin receives and trusts the correct forwarded protocol header.

If you use ECS with NGINX

On ECS, you normally control the web server. NGINX’s own NGINX redirect guidance recommends simple redirects with a separate server block and return 301, rather than complicated rewrite logic. Keep your existing HTTPS server configuration as-is, and add only the HTTP listener redirect after the certificate-backed HTTPS site already works:

server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://$host$request_uri;
}

$request_uri keeps the original path and query string. Do not redirect to a fixed homepage such as https://example.com/ for every URL, because that loses old paths and can look like a soft error to search engines. HTTP 308 also exists in the general HTTP standard, but unless you have verified that the target search platform and your whole stack handle it as expected, use the conventional 301 for this SEO migration.

If you use Apache

On an Apache-managed ECS site, use a virtual-host rule or .htaccess rule that preserves the URI:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

If a load balancer terminates HTTPS before Apache, %{HTTPS} may still look off at the origin. In that case, use the proxy’s documented forwarded-protocol header and test carefully to avoid a redirect loop.

What Baidu should see after the fix

  • http://example.com/ returns one clean 301 to https://example.com/.
  • http://example.com/a/b?c=1 redirects to https://example.com/a/b?c=1, not to the homepage.
  • The HTTPS page returns 200, has a valid certificate, and does not redirect back to HTTP.
  • Canonical tags, sitemap URLs, internal links, and Baidu Search Resource Platform properties use the HTTPS version.
  • Old CDN caches have been purged, so Baidu is not seeing a stale HTTP response.