After you build a website by using Alibaba Cloud Web Hosting and configure a 404 error page in the Web Hosting console, you might receive a 301 status code instead of the expected 404 error page. This issue can occur if you have enabled the force HTTPS feature for your domain name.
Symptom
When a user accesses a non-existent page, the server returns a 301 status code instead of displaying the configured 404 error page.
Cause
This issue occurs because the force HTTPS feature is enabled. When a browser sends an HTTP request for a non-existent page, the server prioritizes the HTTPS redirect rule and returns a 301 status code. This redirect prevents the server from processing the request for the non-existent page and serving the 404 error page.
Solution
-
Log in to the Web Hosting console.
-
Find your Alibaba Cloud Web Hosting instance and click Manage in the Actions column.
-
In the navigation pane on the left, choose .
-
On the Domain Binding page, find the target domain name, and click Disable in the Force HTTPS column.
The status changes to Disabled.
The Force HTTPS column for the domain name will display Disabled, and an Enable link will appear next to it. This indicates that the feature has been successfully disabled.
-
Access a non-existent page on your website to verify that the 404 error page is displayed correctly.
If the issue persists, submit a ticket.