Guides
How to Detect SEO Spam on Your Website
A repeatable detection routine: search-side checks first, then crawler-view comparison, then file and database review.
Published 9 Jul 2026 · Updated 26 Aug 2026 · 2 min read
Short answer
To detect SEO spam, start outside your site: compare the number of indexed URLs in Search Console against your real page count, run a site: query looking for titles you never wrote, then fetch suspect pages with a crawler user agent and diff the response against a normal browser request. Only after that do you search files and database content for the injected code.
Step 1 — Check what search engines have indexed
- Open Search Console → Pages and compare indexed URLs against your sitemap count.
- Run site:yourdomain.com and page deep into the results, not just page one.
- Look for languages you do not publish in, and for directories your CMS does not create.
- Review Settings → Users and permissions for owners you did not add.
Step 2 — Compare the crawler view with the visitor view
Injected spam is normally cloaked. Fetch a suspect URL twice — once with a browser user agent, once with a crawler user agent — and diff the HTML. Then use Search Console's URL inspection to see the version Google actually received, which defeats IP-based cloaking that a spoofed user agent misses.
curl -s -A "Mozilla/5.0" https://example.com/page > visitor.html
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://example.com/page > crawler.html
diff visitor.html crawler.htmlStep 4 — Search files and stored content
STEP 01
Find recently modified files
List files in the web root by modification time. Clusters of changes on one date usually mark the injection.
STEP 02
Look for obfuscation
Grep for base64_decode, eval, gzinflate and long encoded strings in PHP files.
STEP 03
Query the database
Search post content, options and metadata for script tags and unfamiliar domains.
STEP 04
Check scheduled tasks
Review cron jobs and CMS scheduled events used to reinstate deleted files.
What do you do once you find spam?
Treat it as a compromise, not a content issue. Take a forensic copy, remove the injected content, close the entry point, rotate every credential, then serve 404 or 410 for the spam URLs and resubmit your real sitemap. Re-check indexed page counts weekly for a month.
Sources
- Fixing hacked sites: hacked with spam — Google Search Central
- URL Inspection tool — Google Search Central
Prefer summary updates? Subscribe to the newsletter.