Why Are Random Pages Indexed on My WordPress Site? Finding and Removing Spam Content
Discovered thousands of unknown pages indexed on your WordPress site? This is a classic sign of SEO spam injection. Learn how to find, remove, and prevent these malicious pages.
The Suspicious Indexed Pages Problem
You're checking your Google Search Console or performing a site:yourdomain.com search, and suddenly you see thousands of pages you never created. These pages have strange URLs, foreign language content, or promote products you've never heard of. Welcome to one of the most common symptoms of an SEO spam infection - unauthorized pages being generated and indexed on your website.
Common Symptoms
- Indexed page count far exceeds your actual content
- URLs with random strings, dates, or numbers you didn't create
- Japanese, Chinese, or Russian text in search results
- Pages promoting pharmaceuticals, luxury goods, or adult content
- Subdirectories you never created (e.g., /shop/, /buy/, /cheap/)
How Spam Pages Get Created
The Attack Sequence
- Initial Compromise - Attacker gains access through vulnerability or weak credentials
- Backdoor Installation - Hidden PHP files installed for persistent access
- Page Generation - Scripts create thousands of spam pages dynamically
- Sitemap Manipulation - Your sitemap.xml modified to include spam URLs
- Cloaking Implementation - Pages show spam to Googlebot, normal content to you
- Rapid Indexing - Google quickly indexes the pages due to your site's authority
Types of Generated Pages
- Japanese Keyword Hack - Creates pages in Japanese targeting luxury goods
- Chinese Spam Pages - Similar attack with Chinese content
- Pharma Hack - Pages promoting pharmaceuticals (viagra, cialis, etc.)
- Redirect Pages - Pages that redirect visitors to malicious sites
- Doorway Pages - SEO-optimized pages linking to spam destinations
Finding All Spam Pages
Google Search Console Analysis
- Go to Coverage > Valid pages
- Sort by URL to identify patterns
- Look for URLs you don't recognize
- Export the list for cleanup reference
Google Search Operators
site:yourdomain.com -inurl:your-known-pages site:yourdomain.com intext:viagra site:yourdomain.com inurl:/buy/ site:yourdomain.com inurl:/shop/ (if you don't have a shop)
WP Folder Shield Detection
Use WP Folder Shield's scanning tools:
- Full Site Scanner - Identifies malicious PHP files generating pages
- Root Monitor - Detects unauthorized files in WordPress root
- Database Scanner - Finds spam content injected into posts/options
Removing Spam Pages
Step 1: Stop Page Generation
First, remove the source of new spam pages:
- Run WP Folder Shield Full Site Scan
- Identify and delete malicious PHP files
- Check wp-content/uploads for PHP files (shouldn't exist)
- Review theme files for injected code
- Examine wp-config.php for modifications
Step 2: Clean the Database
If pages are database-generated:
- Check wp_posts for spam entries
- Review wp_options for injected code
- Examine wp_postmeta for suspicious data
- Clear any malicious cron jobs
Step 3: Fix .htaccess
Check for redirect rules serving spam:
- Compare to default WordPress .htaccess
- Remove any unfamiliar rewrite rules
- Check for cloaking conditions (user-agent checks)
Step 4: Remove from Google's Index
After cleanup, remove indexed spam pages:
- Google Removals Tool - Search Console > Removals > New Request
- Robots.txt Blocking - Temporarily block spam URL patterns
- 404 Response - Ensure deleted URLs return 404
- Submit Clean Sitemap - Replace any hijacked sitemap
Using Google's Removals Tool
For Individual URLs
- Go to Search Console > Removals
- Click "New Request"
- Enter the spam URL
- Select "Remove URL temporarily"
- Submit
For URL Prefixes
If spam pages share a common prefix (e.g., /buy/*):
- Use "Remove all URLs with this prefix"
- Enter the prefix (e.g., https://yourdomain.com/buy/)
- This removes entire directory structures
Important Notes
- Removals are temporary (6 months) - pages must return 404
- Don't remove legitimate pages by accident
- Process may take 1-2 days
Preventing Future Spam Page Generation
WP Folder Shield Protection Layers
- Directory Protection - Blocks PHP execution in uploads where spam scripts hide
- File Integrity Monitoring - Alerts when new suspicious files appear
- Root Monitor - Watches WordPress root for unauthorized files
- Web Application Firewall - Blocks exploit attempts that lead to compromise
- Login Security - Prevents credential theft enabling initial access
Monitoring Strategy
- Weekly check of indexed page count in Search Console
- Set up Google Alert for
site:yourdomain.com - Enable WP Folder Shield email alerts
- Monthly manual
site:search review
Recovery Timeline
Week 1
- Complete cleanup and spam page removal requests
- Implement WP Folder Shield protection
Weeks 2-4
- Google processes removal requests
- Indexed page count decreases
- Monitor for any new spam pages
Months 1-3
- Search results clear of spam pages
- Rankings stabilize
- Traffic recovers to pre-infection levels
Conclusion
Random indexed pages are a serious symptom of SEO spam infection. The key to resolution is identifying and removing the source (malicious files), cleaning up the evidence (database and .htaccess), removing the pages from Google's index, and implementing protection to prevent recurrence. WP Folder Shield addresses all stages of this process, from detection through prevention.
Written by David Kim
WP Folder Shield Team