Search engine optimization and indexation begin at the network crawl perimeter. Regardless of how well an application is designed, if automated search bots encounter crawl bottlenecks, infinite parameter loops, uncompressed sitemaps, or misleading canonical headers, entire content catalogs will remain stranded in Google Search Console as "Crawled - currently not indexed" or "Discovered - currently not indexed".
Maximizing search engine indexing requires a synchronized crawl architecture: a hardened robots.txt file governing bot access pacing, a dynamic XML Sitemap protocol delivering 100% clean 200 OK canonical destinations, and real-time push protocols like IndexNow. This technical architectural guide details production implementations using PHP 8.3 and modern web servers.
1. Demystifying Search Engine Crawl Budget
Search engines do not allocate infinite crawl resources to any single domain. Google calculates an algorithmic ceiling known as your Crawl Budget, which consists of two primary drivers:
- Crawl Capacity Limit (Host Load): How fast your web server can respond without degrading user traffic. If your server returns 500 errors, 429 rate limit exceptions, or slow TTFB (> 1,000ms), Googlebot automatically reduces crawl velocity to protect system health.
- Crawl Demand: How frequently Googlebot desires to crawl your domain based on URL popularity, content freshness, site authority, and internal link structure.
When websites generate thousands of near-duplicate programmatic pages, unindexed faceted filter URLs (e.g. ?color=blue&sort=price_desc), or uncompressed sitemaps, Googlebot exhausts its crawl budget on low-value URLs, delaying the indexing of high-authority service offerings and editorial articles.
2. Production Robots.txt Architecture
The robots.txt file represents the initial handshake between a web server and automated crawlers. A properly formatted robots file prevents crawl waste while granting unrestricted access to critical CSS, JS, and font assets essential for full Chromium rendering.
A. Strategic Crawler Differentiation
Modern robots architecture must account for different crawler types: primary search indexers (Googlebot, Bingbot), auditing tools (AhrefsBot, SemrushBot), and AI answer engines (GPTBot, ClaudeBot, PerplexityBot):
# ═══════════════════════════════════════════════════════════════════
# Primary Search Engine Crawlers (Full Crawling & Fast Consolidation)
# ═══════════════════════════════════════════════════════════════════
User-agent: Googlebot
Allow: /
# Disallow infinite parameter combinations that waste crawl budget
Disallow: /*?*sort=*
Disallow: /*?*filter=*
Disallow: /admin/
Disallow: /writable/
User-agent: Bingbot
Allow: /
Crawl-delay: 1
Disallow: /*?*sort=*
Disallow: /*?*filter=*
# ═══════════════════════════════════════════════════════════════════
# SEO Audit Bots: Paced crawling to protect server performance
# ═══════════════════════════════════════════════════════════════════
User-agent: AhrefsBot
Crawl-delay: 2
Disallow: /*?*sort=*
User-agent: SemrushBot
Crawl-delay: 2
Disallow: /*?*sort=*
# ═══════════════════════════════════════════════════════════════════
# AI Search & Conversational Agents (GEO / LLM Retrieval)
# ═══════════════════════════════════════════════════════════════════
User-agent: GPTBot
Allow: /
User-agent: ChatGPT-User
Allow: /
User-agent: PerplexityBot
Allow: /
User-agent: ClaudeBot
Allow: /
# ═══════════════════════════════════════════════════════════════════
# Global Sitemaps Declaration
# ═══════════════════════════════════════════════════════════════════
Sitemap: https://umakantdev.com/sitemap.xml
Critical Caution: Never disallow assets using Disallow: /*.css$ or Disallow: /*.js$. Googlebot requires full access to stylesheet and script assets to render the Document Object Model and evaluate mobile responsiveness and Core Web Vitals.
3. Dynamic High-Performance XML Sitemap Architecture
An XML sitemap acts as a direct indexing roadmap for search engines. Sitemaps must conform strictly to the sitemaps.org standard:
- Exclusively 200 OK Canonical URLs: Never include 301 redirects, 404 broken URLs, trailing slash variants, or pages marked with
noindex. Including non-canonical URLs dilutes sitemap authority and triggers Search Console validation failures. - Sitemap Chunking: Individual sitemaps cannot exceed 50,000 URLs or 50 MB uncompressed. Large applications must implement a Sitemap Index (
sitemap-index.xml) pointing to child sitemaps. - Accurate lastmod Timestamps: Provide authentic W3C Datetime strings (
YYYY-MM-DD). Never spoof today's date on unchanged articles; Google cross-references HTTP headers and ignores falsified sitemap dates.
A. Building a Streaming Dynamic Sitemap Controller in PHP
For high-throughput applications, generating dynamic XML in memory without memory exhaustion requires clean architectural structuring:
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use App\Models\BlogModel;
class Sitemap extends Controller
{
public function index()
{
// 1. Deliver static pre-generated sitemap if available (1ms response)
$staticFile = FCPATH . 'sitemap.xml';
if (is_file($staticFile) && filesize($staticFile) > 0) {
return $this->response
->setHeader('Content-Type', 'application/xml; charset=UTF-8')
->setHeader('Cache-Control', 'public, max-age=86400, must-revalidate')
->setBody(file_get_contents($staticFile));
}
// 2. Fetch canonical records
$posts = BlogModel::getAllPosts();
// 3. Assemble validated entries
$xml = [];
$xml[] = '<?xml version="1.0" encoding="UTF-8"?>';
$xml[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
// Dynamic articles
foreach ($posts as $post) {
$xml[] = ' <url>';
$xml[] = ' <loc>' . htmlspecialchars(base_url('blog/' . $post['slug']), ENT_XML1, 'UTF-8') . '</loc>';
$xml[] = ' <lastmod>' . date('Y-m-d', strtotime($post['publish_date'])) . '</lastmod>';
$xml[] = ' <changefreq>monthly</changefreq>';
$xml[] = ' <priority>0.80</priority>';
$xml[] = ' </url>';
}
$xml[] = '</urlset>';
return $this->response
->setHeader('Content-Type', 'application/xml; charset=UTF-8')
->setHeader('Cache-Control', 'public, max-age=86400, must-revalidate')
->setBody(implode("\n", $xml));
}
}
4. Automating Real-Time Indexation via IndexNow
Traditional sitemap discovery requires search engines to periodically poll your XML file. The IndexNow protocol—supported by Microsoft Bing, Yandex, Seznam, and Naver—instantly informs participating search engines when URLs are published, updated, or deleted, initiating near-instantaneous indexing:
<?php
// Dispatch Real-Time IndexNow Notification
function submitToIndexNow(array $urls, string $apiKey, string $host): bool
{
$payload = [
'host' => $host,
'key' => $apiKey,
'keyLocation' => "https://{$host}/{$apiKey}.txt",
'urlList' => $urls
];
$ch = curl_init('https://api.indexnow.org/indexnow');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json; charset=utf-8'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_TIMEOUT => 5
]);
$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $statusCode === 200 || $statusCode === 202;
}
Diagnosing and Resolving GSC "Crawled - Currently Not Indexed"
When Google Search Console reports URLs under "Crawled - currently not indexed", it signifies that Googlebot successfully fetched and rendered the HTML, but algorithmic quality filters determined the page lacked sufficient distinct value to warrant indexation.
Follow this checklist to resolve the status:
- Audit Programmatic Thin Pages: If generating multi-location or directory pages, audit whether templates provide unique, distinctive content. Programmatic pages differing by only a city name should carry
<meta name="robots" content="noindex, follow">to prevent doorway penalties and preserve crawl budget. - Audit Non-HTML Resources: Verify that internal scripts do not expose resource URLs (like JSON or XML documents) as discoverable page links. Assets should send
X-Robots-Tag: noindex, nofollowheaders. - Sitemap Hygiene: Strictly ensure your XML sitemap only lists 200 OK indexable canonical pages. Never include utility endpoints or URLs returning noindex directives in your sitemap.
- Strengthen Internal Linking: Ensure every critical article receives multiple incoming contextual links from high-authority hub pages rather than remaining isolated at the edge of the site taxonomy.
Summary
A resilient search architecture balances crawler guidance and resource prioritization. By pairing a strategic robots.txt file with lightweight, canonical-only XML sitemaps and immediate IndexNow dispatches, you eliminate crawl waste and establish frictionless indexation across search engines.
