Which parts need to be changed when replacing HTTP with HTTPS, including the internal addresses and redirections?
In the action list for switching to HTTPS, the certificate is just the first step. What truly determines whether the switch is clean is changing four types of addresses together: the redirection rules from old addresses to new addresses, the absolute addresses hardcoded within the site, the files submitted to search engines, and the configuration of pseudo-static and standard addresses. The result of installing only the certificate is usually that old protocol addresses are still accessible, warnings of mixed content appear on pages, and the sitemap still shows the old protocol——leaving tails for both inclusion and access. The reasonable sequence is: certificate and listening, unified redirection, bulk replacement, update the list, and review mixed content.
Step 1: Certificate and service listening
Run the new protocol first and then discuss changing the address. Check three things: whether the certificate-covered domain name includes both the naked domain and the version with www; whether the protocol configuration on the front-end service is correct; whether the application layer needs to perceive the original protocol. Common deployment methods of AnQiCMS (Baota panel and aaPanel, LNMP command deployment, Docker image) all configure certificates on the front-end Nginx, and the application listens to port 8001 by default, so the protocol change mainly falls on the front-end service and background configuration, rather than changing the code.
After this step is done, visit the new address once using an incognito window to confirm that the certificate chain is complete and there are no degradation prompts.
Second step: How to configure redirection for the old address.
Redirects should be closed off according to rules, not handled page by page. The goal is to have only one entry point for the same content: from http to https, from naked domain to www (or reverse), completed in one go, without any double jumps. AnQiCMS backend provides 301 redirect management, used to set URL redirection, configure the combination rules of protocols and domain names here, which is easier to verify than writing rules at multiple locations.
Three details:
- The homepage and inner pages should be covered. Redirecting only the homepage is a common oversight, as old addresses with paths are still accessible under the old protocol.
- Use 301 instead of temporary redirects. Protocol switching is a permanent change, while temporary redirects will cause search engines to continue to retain the old addresses.
- The redirected address should point to a standard address to avoid mutual loops with the standard address configuration.
Step three: batch replacement of absolute addresses within the site.
Old protocol addresses hardcoded in the text and templates are the main source of mixed content warnings. Range control is more important than speed during batch processing.
The AnQiCMS full-site replacement tool can batch replace keywords or links, suitable for replacing batch absolute addresses of old protocols in the text. Three points to note: first, limit the replacement scope (category or column), to avoid changing the same strings that legally appear in the text; make a backup before replacing, and check several articles after replacing; the hard-coded addresses in the navigation and single-page pages will not take effect with the batch replacement of the text, and need to be opened separately to modify the navigation settings and single-page management one by one.
The image and attachment address should also be checked. The absolute address of the materials with protocol in the historical articles should be replaced, and several pages should be checked to confirm that the resources can be loaded, to avoid the image not displaying.
Step 4: The list-type files should be changed together
The list submitted to search will not change protocols automatically, and the generated results need to be confirmed.
The site map (sitemap) is automatically generated by the system, and it is important to check whether the addresses within it are already in the new protocol and whether they are consistent with the redirection direction of the new configuration. If the list still contains old addresses, the crawling program will have to take an extra step each time, which is not conducive to the unification of addresses in the long run. AnQiCMS supports automatic generation of site maps, and after switching, it can be regenerated and checked once.
If the site map address is referenced in Robots.txt, it should also be updated synchronously; at the same time, check for any rules remaining for old protocols. AnQiCMS supports robots configuration, and it should be checked once in text format after modification.
Static page and standard address should be confirmed at this step: AnQiCMS supports static page rule management, can customize static page URL, the rule itself does not contain a protocol, but the protocol in the list and standard address should be consistent with the new entry.
Fifth step: Review mixed content and residue
Three easy-to-miss places:
- Templates that reference third-party scripts and font addresses will trigger mixed content blocking directly if they are written with the old protocol, resulting in style disarray or partial interaction failure.
- External link images with protocols in comment and rich text historical content.
- Form submission address and API call address: if the interface base address in the front-end script is set to the old protocol, the submission will fail.
Verification method is simple and reliable: after switching, open several typical pages (home page, column list, article details, form page), check the browser's security prompts for each page, and check a page with an old protocol to confirm that it jumps to the new address once.
Common questions
Should the old address be retained for a period of time to be accessible?Retained but only in the form of a redirect. If the old address returns content directly, it will form two entries. If the old address returns 404, it will harm the existing external links and收录.
What should be done if the main text cannot be changed completely?Prioritize the processing of list-type files and redirect rules; the batch replacement of the main text can be promoted by categories; as long as the redirection and standard address are unified, the impact of un-replaced absolute addresses is controllable.
Will the inclusion drop if the protocol changes?In the short term, the old address is redirected to the new address, which is a normal transition. Regenerating the site map and keeping the new content push running in the link push management are two actions to shorten the transition period.
How long will it take to confirm the completion of the switch?When all the old protocol addresses are redirected at one time, there are no mixed content warnings on the page, and both the sitemap and robots are the new protocol, it can be considered that the internal actions are completed, and the remaining observations are left to the indexing data.