Audit my site
Technical SEOIntermediateChecked against Google docs · Oct 2026

HTTPS and site security: migration, mixed content, HSTS and hacked sites

HTTPS is the baseline Google expects, and a clean migration keeps every signal pointing at the secure URLs. The bigger risk to search is a hacked site: injected spam, malware or phishing that brings warning labels, interstitials and manual actions until you clean up and request a review.

Author: Eugene Serbin, Head of SEO at Semalt Updated: 30 October 2026 Reading time: 21 min Visuals: 4

In short

HTTPS protects your visitors, and Google prefers the HTTPS version of a page as canonical when both exist. A correct move to HTTPS means a 301 from every HTTP URL to the same HTTPS URL, with canonicals, sitemaps, hreflang and internal links all switched to HTTPS and no mixed content left behind. Security does not stop at the certificate: a hacked site with injected spam, malware or phishing can get warning labels in search, browser interstitials or a manual action, so you need to monitor, clean up fully and then request a review.

Why HTTPS matters for search

Google does not describe HTTPS as a big ranking lever, and you should not either. What Google does say is concrete. Its page experience self-assessment asks: “Are your pages served in a secure fashion?” Google's web.dev guide on enabling HTTPS states: “Google uses HTTPS as a positive search quality indicator.” And the Search Console Help for the HTTPS report puts it plainly: “Google strongly recommends using HTTPS for your site to protect your users' security and privacy.”

Keep this in proportion. On the same page experience page, Google writes that “Beyond Core Web Vitals, other page experience aspects don't directly help your website rank higher in search results.” It adds that “they can make your website more satisfying to use, which is generally aligned with what our ranking systems seek to reward.” HTTPS will not lift a weak page above a stronger one. Its effect on search is more practical:

What Google officially says

“Google prefers HTTPS pages over equivalent HTTP pages as canonical, except when there are issues or conflicting signals such as the following:”

Google Search Central — How to specify a canonical URL

The four exceptions Google lists, word for word:

To make sure Google picks HTTPS, the same page recommends: “Add redirects from the HTTP page to the HTTPS page.” “Add a rel="canonical" link from the HTTP page to the HTTPS page.” “Implement HSTS.”

“Avoid bad TLS/SSL certificates and HTTPS-to-HTTP redirects because they cause Google to prefer HTTP very strongly. Implementing HSTS cannot override this strong preference.”

Google Search Central — How to specify a canonical URL

Two more rules from that page: “Don't include the HTTP version of your pages in your sitemap or hreflang annotations rather than the HTTPS version.” And: “Avoid implementing your SSL/TLS certificate for the wrong host-variant. For example, example.com serving the certificate for subdomain.example.com.”

“If your site has a page with both an HTTP and HTTPS address, Google prefers to index the HTTPS version.”

Search Console Help — HTTPS report

Certificate basics

HTTPS is HTTP over TLS. The server presents a certificate issued by a certificate authority (CA). The browser checks that the certificate is valid, not expired, issued by a trusted CA and issued for the exact hostname it is visiting. If any of these checks fails, the visitor sees a full-page warning and Search Console reports “HTTPS has invalid certificate”, which Google says “Typically this affects an entire site.”

HTTP to HTTPS migration step by step

Google treats a switch to HTTPS as a site move with URL changes: its site move guide lists “URL changes from HTTP to HTTPS” as the first example. The URLs change only in the protocol, so the move is simple, but every signal still has to switch together.

Timeline · HTTP to HTTPS migration checklist
HTTP to HTTPS migration timeline Three phases. Before: get a certificate for all hosts, serve HTTPS and test the chain, make internal links HTTPS, fix mixed content, switch canonicals, sitemap and hreflang to HTTPS. Switch day: 301 every HTTP URL in one hop, check robots.txt on HTTPS, add a Domain property in Search Console, submit the HTTPS sitemap, test redirects. After: watch the HTTPS and Page indexing reports, check crawl stats and 404s, update important external links, keep redirects at least a year, add HSTS with a low max-age and raise it. 1 · Before the switch 2 · Switch day 3 · After the switch Certificate for every host Serve HTTPS, test the chain Internal links to HTTPS Fix mixed content on templates HTTPS canonicals, sitemap, hreflang 301 every HTTP URL, one hop Check robots.txt on HTTPS Domain property in Search Console Submit the HTTPS sitemap Test redirects on sample URLs Watch HTTPS + Page indexing Check Crawl stats and 404s Update key external links Keep redirects at least 1 year HSTS: low max-age, then raise Order matters: HTTPS must work fully before the redirects go live, and HSTS comes last.
Prepare everything on HTTPS first, switch all signals on one day, then monitor and only later lock in HTTPS with HSTS.
  1. Get the certificate. Google's site move guide: “For a move to HTTPS, get and configure the required TLS certificates on your server.” Include every hostname you serve.
  2. Serve the site on HTTPS without redirecting yet. Test every template: home, category, product, article, search, forms, checkout, login.
  3. Switch internal links and resources. Use https:// or root-relative paths (/img/logo.png) in templates, menus, content, CSS files and JavaScript. In a CMS, replace old absolute http://example.com URLs in the database with a tested script, not by hand.
  4. Switch canonicals to HTTPS. Every page's rel="canonical" should point to its own HTTPS URL. A leftover HTTP canonical is one of Google's listed exceptions.
  5. Switch sitemaps and hreflang. List only HTTPS URLs in the sitemap; all hreflang annotations should use HTTPS URLs.
  6. Update everything else that holds URLs: structured data, Open Graph tags, feeds, CDN and cache rules, analytics and ad settings, email templates, and app deep links.
  7. Turn on 301 redirects. Every HTTP URL redirects to the same path and query on HTTPS, in one hop. Combine it with your host choice: http://www.example.com/a?x=1 goes straight to https://example.com/a?x=1, not via https://www.example.com/a?x=1.
  8. Check robots.txt on HTTPS. https://example.com/robots.txt is the file that now counts. Make sure it does not block what the HTTP one allowed.
  9. Set up Search Console. A Domain property covers both protocols and all subdomains. If you use URL-prefix properties, add the HTTPS one. Submit the HTTPS sitemap there.
  10. Skip Change of Address. Google: “You don't need it for HTTP to HTTPS moves, switching between www and non-www on the same domain, or moving paths within the same domain.”
  11. Monitor. Use the HTTPS report, Page indexing, Crawl stats and Performance reports, plus a crawl of the HTTP URL list to confirm each one returns a single 301 to a 200 page.
  12. Keep the redirects. Google advises: “Keep the redirects for as long as possible, generally at least 1 year.” For HTTP to HTTPS there is rarely a reason to ever remove them.
  13. Add HSTS last, once everything above is stable (see below).

A minimal nginx setup that sends every HTTP request, and the www host, to one HTTPS host in a single hop:

# HTTP, both hosts: one hop to the final HTTPS URL
server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}
# HTTPS www: needs a valid certificate for www too
server {
    listen 443 ssl;
    server_name www.example.com;
    return 301 https://example.com$request_uri;
}

In Search Console's HTTPS report, the errors that matter most during a migration are “HTTP marked with canonical tag”, “HTTPS has invalid certificate”, “Sitemap points to HTTP”, “HTTPS has redirect” (the HTTPS URL redirects to HTTP), “HTTPS URL is roboted” and “HTTPS not evaluated”. Fix them early: Google warns that “If a site has a lot of HTTPS issues, it can prompt Google to stop crawling your HTTPS pages.” The report is “available only for Domain properties and HTTPS URL-prefix properties.”

Mixed content

web.dev defines it: “A page has mixed content when its initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, and scripts) are loaded over an insecure HTTP connection.” It weakens the whole page, because those HTTP requests can be read and changed on the network.

“There are two types of mixed content: active and passive.”

For search this matters twice. Google's canonical rules name “insecure dependencies (other than images)” as a reason it may not prefer the HTTPS page. And when blocked scripts or styles break rendering, Google may see a different page from the one you designed.

Code · Mixed content vs fixed

✕ HTTPS page, HTTP resources

<!-- page: https://example.com/shop/ -->
<link rel="stylesheet"
  href="http://example.com/css/main.css">
<script
  src="http://cdn.example.com/app.js"></script>
<img
  src="http://example.com/img/logo.png">
<iframe
  src="http://maps.example.com/embed"></iframe>
  • Stylesheet, script, iframe: active, blocked
  • Image: passive, upgraded or not loaded
  • Page shown as not fully secure

✓ Fixed

<!-- page: https://example.com/shop/ -->
<link rel="stylesheet"
  href="/css/main.css">
<script
  src="https://cdn.example.com/app.js"></script>
<img
  src="/img/logo.png">
<iframe
  src="https://maps.example.com/embed"></iframe>
  • Root-relative paths for your own files
  • https:// for other hosts
  • No resource depends on HTTP
Every resource on an HTTPS page has to load over HTTPS; links (<a href>) are a separate case.

How to find mixed content

  1. DevTools. Open key templates over HTTPS and check the Issues tab and the console. Messages only cover the page you are on, so this works for templates, not for a whole site.
  2. Search the source. web.dev's advice: “Search for http:// in your source and look for tags that include HTTP URL attributes.” Include the database, theme files, CSS (url(http://…), @import, fonts) and JavaScript.
  3. Crawl. A crawler that records the resources of each HTML page lists every HTTP image, script and stylesheet across the site.
  4. Collect browser reports. Send a Content-Security-Policy-Report-Only header; real visitors' browsers then report every insecure request without blocking anything.

How to fix it

Change each http:// resource to https:// or to a relative path. If a third party does not offer HTTPS, host the file yourself (if you are allowed to), use another provider or remove it. As a safety net, not a replacement for fixing the source, you can send:

Content-Security-Policy: upgrade-insecure-requests

The browser then requests HTTPS versions of HTTP resources. If a resource has no HTTPS version, it simply fails to load.

Plain links are not mixed content: a <a href="http://…"> makes the browser navigate away, so web.dev says such links “usually don't need to be fixed”. The trap is a gallery or lightbox script that loads the linked HTTP image into the page. Your own internal links should still be HTTPS, to avoid a redirect on every click.

HSTS and preload

HTTP Strict Transport Security tells the browser: for this host, use HTTPS only, for the next max-age seconds. After the first HTTPS visit, the browser rewrites any http:// link to https:// before sending a request. That removes the redirect round trip for repeat visitors and protects against downgrade attacks.

# start low while testing
Strict-Transport-Security: max-age=300
# then, once stable
Strict-Transport-Security: max-age=31536000; includeSubDomains

The catch is that HSTS gives visitors no way to click past a certificate error. web.dev warns: “Don't enable HSTS until you're certain your site operation is robust enough to avoid ever deploying HTTPS with certificate validation errors.” If a certificate expires while HSTS is active, returning visitors cannot get in at all until you fix it. Hence the second piece of advice: “You can start with low values and gradually increase the max-age as you become more comfortable operating an HTTPS-only site.”

Other security headers

These headers are good practice for protecting users and the site. They are not ranking factors, and you do not need them for Google to index you, but they make several common attacks much harder.

HeaderTypical valueWhat it does
Content-Security-Policydefault-src 'self'; …Limits where scripts, styles and other resources may load from. Strong protection against injected scripts, but needs careful testing (start with Report-Only).
X-Content-Type-OptionsnosniffStops browsers from guessing file types, so an uploaded file cannot run as a script.
frame-ancestors (CSP) or X-Frame-Options'self' / SAMEORIGINStops other sites framing your pages (clickjacking).
Referrer-Policystrict-origin-when-cross-originControls how much of the URL is sent to other sites.
Permissions-Policycamera=(), geolocation=()Turns off browser features the site does not use.
Set-Cookie flagsSecure; HttpOnly; SameSite=Laxweb.dev: “Always set the Secure flag on cookies.” HttpOnly hides cookies from scripts; SameSite limits cross-site sending.

How hacking hurts search

Google's spam policies define the problem: “Hacked content is any content placed on a site without permission, due to vulnerabilities in a site's security.” Most hacks on ordinary sites are not personal. Bots scan for outdated software and weak passwords, then use the site's reputation to rank spam, spread malware or host phishing pages. The owner often sees nothing, because “If a site is hacked, it's not uncommon for the hacker to use cloaking to make the hack harder for the site owner to detect.”

The damage in search comes in several forms. Google's Security issues help says that affected pages “can appear with a warning label in search results or an interstitial warning page in the browser when a user tries to visit them”, and that “Google tries its best to keep hacked content out of our search results.” Spam aimed at search can also lead to a manual action, and thousands of injected pages compete for crawling with your real content.

Cheat sheet · Types of hacked and harmful content
TypeWhat it looks likeWhere to lookSearch Console issue
Code injectionMalicious JavaScript or iframes in existing pages; redirects, crypto miningRendered HTML, theme and plugin files, database optionsHacked: Code injection
Content injectionHidden spam links or text, often pharma or gambling, sometimes shown only to GooglebotURL Inspection, curl as Googlebot, page sourceHacked: Content injection
URL injectionNew spam pages or folders you never created, often in another languagesite: search, Page indexing, Performance queries, unknown sitemapsHacked: URL injection
Sneaky redirectsVisitors from Google, or on mobile, are sent to another site; direct visits look normalcurl with a Google referrer, server config, .htaccessHacked: Code injection
MalwareCode that harms visitors' devices without them actingChrome warnings, sample URLs in the reportHacked: Malware
Harmful downloadsFiles that are malware or unwanted software, or links to themDownload folders, upload directoriesHarmful downloads / Links to harmful downloads
Social engineeringPhishing logins, fake “update” or tech-support pages, deceptive adsExample pages, ad and embed codeDeceptive pages / Deceptive embedded resources
Third-party spamSpam in comments, forums, profiles, free hosting, internal search pagessite: search with spam words, user-content areasManual action: Site abused with third-party spam
Issue names are the labels used in Search Console; the last row appears in the Manual actions report, not in Security issues.

Security Issues and Manual Actions reports

The Security issues report is where Google tells you what it found: “If a Google evaluation determines that your site was hacked, or that it exhibits behavior that could potentially harm a visitor or their computer, the Security issues report will show Google's findings.” Issues fall into three groups: hacked content, malware and unwanted software, and social engineering. Expand an issue to see the date it was first detected and sample URLs. The samples are “not necessarily complete”, and an issue with no samples does not mean no pages are affected.

If you cannot reproduce a warning, trust the report rather than your own browser: Google says you “should rely on the Security Issues report as the source of truth to verify whether any security issues exist for your site, or if they have been fixed.” One issue is softer than the rest. For “Uncommon downloads”, Google notes that it “will not prevent your page or site from appearing in Google Search results”, although Chrome may warn about the file.

The Manual actions report covers a different kind of problem. Google explains the difference:

“The Manual Actions report lists issues with a page or site that are mostly attempts to manipulate our search index, but are not necessarily dangerous for users.”

Search Console Help — Security issues report

The consequence is spelled out in the Manual actions help: “If a site has a manual action, some or all of that site will not be shown in Google search results.” A hack can show up in both reports: malware and phishing in Security issues, mass spam pages or abused user content as a manual action such as “Site abused with third-party spam”. Check both, and make sure you get Search Console messages by email.

Bought a domain with a history? Google covers it: fix the issues, then say in your reconsideration request “that you recently acquired the site and that it now adheres to the spam policies for Google web search.”

Cleaning up a hacked site and requesting review

Flow · Hacked-site recovery, from detection to review
Hacked-site recovery flow Eight steps in two rows. 1 Detect: Security issues report, site: search, alerts. 2 Contain: back up the hacked state, maintenance mode. 3 Find the entry point: old plugin, stolen password, open folder. 4 Clean: restore clean files, delete spam URLs. 5 Close the hole: update, remove unknown users, rotate passwords. 6 Verify: URL Inspection and curl with a Google referrer. 7 Request review: describe the fixes, do not resubmit. 8 Monitor: reports, logs and new pages in site: search. STEP 1STEP 2STEP 3STEP 4 STEP 5STEP 6STEP 7STEP 8 DetectContainFind the entry pointClean Close the holeVerifyRequest reviewMonitor Security issues report,site: search, alerts Back up hacked state,maintenance mode Old plugin, stolenpassword, open folder Restore clean files,delete spam URLs Update, remove users,rotate all passwords URL Inspection, curlwith Google referrer Describe the fixes;do not resubmit Reports, logs, newpages in site: search
Cleaning without closing the entry point is the most common reason a site gets hacked again within days.
  1. Confirm the issue safely. Google advises: “Avoid using a browser to directly view infected pages on your site.” Use URL Inspection to see the page as Google sees it, and curl to imitate a visitor arriving from Google, because “Hackers often attack only specific user-agents or referrers to avoid detection and select better targets”:
    curl -sv --referer "https://www.google.com/" \
      -A "Mozilla/5.0 (Linux; Android 14) Mobile" \
      https://example.com/page.html
  2. Contain it. Put the site into maintenance mode if visitors are at risk, and take a copy of the hacked files, database and logs before you change anything. You need it to find out how the attacker got in.
  3. Check who has access. Look for unknown admin users in the CMS, unknown FTP, SSH or hosting accounts, and unknown owners in Search Console. Remove them.
  4. Find all the changes. Search files and the database for code you did not write. Google suggests: “Useful search terms include "search", "eval", "base64_decode", and "unescape".” Compare core files with clean copies, and look for recently modified files, unknown PHP files in upload folders, and edited .htaccess or server config.
  5. Find injected URLs. Run site:example.com searches, alone and with spam words such as site:example.com pharmacy. Check Performance for queries unrelated to your business and the Sitemaps report for sitemaps you did not submit.
  6. Clean. Google gives two options: “replace affected files with the last good backup” or remove the spam yourself. Make sure the backup predates the hack. Spam URLs you delete should return 404 or 410, not redirect to your home page.
  7. Close the entry point. Update the CMS, plugins and themes, remove anything unused, and change every password and key: CMS, database, hosting, SFTP and API keys.
  8. Fix everything, everywhere. “Fix the issue throughout your site. Fixing the issue on just some pages will not earn you a partial return to search results.” If several issues are listed, fix all of them.
  9. Request a review. In the Security issues report select Request Review and describe what you did. Google says a good request “Explains the exact quality issue on your site”, “Describes the steps you’ve taken to fix the issue” and “Documents the outcome of your efforts.” For a manual action, use Request Review in the Manual actions report.
  10. Wait, and do not resubmit. “A review can take from a few days to a few weeks to complete.” Resubmitting too early backfires: “Submitting a reconsideration request when the issue hasn't been fixed can cause longer turnaround time for the next request, or even get you marked as a repeat offender.”

Prevention

Google's prevention guide opens with: “The price of freedom from malware is eternal vigilance.” In practice, most hacks are prevented by a handful of habits:

Check your site's HTTPS and security signals

OurSEO Tools runs a 69-point checklist that includes a security section, and crawls up to 1,000 pages recording the status code, canonical, indexability and load time of every URL, so you can spot HTTP leftovers and redirect problems in one run.

69-point checklistTechnical crawlContent analysis

Common mistakes

FAQ

Does HTTPS boost rankings?

Google says it “uses HTTPS as a positive search quality indicator”, but also that page experience aspects beyond Core Web Vitals “don't directly help your website rank higher”. Expect no jump in positions from HTTPS alone. Its real effects are on canonical choice, user trust and data.

Do I need a paid or EV certificate for SEO?

No. A free, automatically renewed certificate works the same in search. What matters is that it is valid, complete and covers every host you serve.

Do I need a new Search Console property or Change of Address?

No Change of Address: Google says you do not need it for HTTP to HTTPS moves. A Domain property already covers both protocols. With URL-prefix properties, add and verify the HTTPS version.

Will I lose traffic when moving to HTTPS?

A short period of fluctuation while Google recrawls is normal for any move. When every URL redirects in one hop and canonicals, sitemaps and internal links already use HTTPS, the move is usually uneventful.

Is mixed content an SEO problem or only a browser problem?

Both. Browsers block active mixed content, which can break the page. Google lists “insecure dependencies (other than images)” as a reason it may not prefer the HTTPS page as canonical.

My site was hacked and cleaned. When do the warnings go away?

After you request a review in the Security issues report and Google confirms the fix. Google says a review “can take from a few days to a few weeks”. Do not resubmit while a request is pending.

Sources

Quotes checked against the official pages on 30 October 2026.