Get prerendering configured in your stack with copy-paste examples. Log in to see personalized configuration examples.
service.botrender.com serves cached HTML. On a cache miss it returns 404 to the crawler and queues a render job. The next crawl will receive the prerendered HTML. Optionally, your server can fall back to serving your SPA when a 404 is returned from BotRender (examples below). Human users are not affected and continue to get your normal app.X-Botrender-Tokenon Nginx/Apache, and passtokento the Express middleware (e.g.process.env.BOTRENDER_TOKEN). This ensures only authorized traffic can queue renders and record statistics.You can implement synchronous rendering, but expect slower responses for bots and higher risk of crawler timeouts.If you choose this, restrict it to a few critical routes, set strict timeouts, and prefer pre-warming via recache APIs.
Log in to see your organization UID automatically included in all configuration examples below. This makes setup much faster and eliminates copy-paste errors.
.htaccess Configuration
Server Block Configuration
Middleware Integration
Express Server Setup
Express Server Setup
Express Server Setup
Edge Computing Integration
Configure Apache server with .htaccess for seamless bot detection and prerendering
# Enable URL rewriting
RewriteEngine On
# Set your BotRender organization UID
SetEnv BOTRENDER_ORG_UID "YOUR_ORGANIZATION_UID"
# Detect comprehensive list of crawlers, bots, and AI platforms
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|slurp|duckduckbot|baiduspider|yandexbot|sosospider|exabot|facebot|ia_archiver|chatgpt-user|gptbot|openai|anthropic-ai|claude-web|google-extended|googleother|bingpreview|perplexitybot|cohere-ai|cohere-crawler|bytespider|bytedance|you-bot|neevabot|huggingfacebot|ccbot|airesearchbot|diffbot|scaleai|facebookexternalhit|facebookbot|twitterbot|linkedinbot|pinterestbot|redditbot|discordbot|telegrambot|slackbot|whatsapp|vkshare|skypeuripreview|snapchat|embedly|quora|showyoubot|outbrain|flipboard|medium|tumblr|ahrefsbot|semrushbot|mj12bot|dotbot|rogerbot|blekkobot|domainappender|spbot|applebot|googlebot-mobile|bingbot-mobile|adsbot-google|mediapartners-google|archive.org_bot|wayback|wget|curl|w3c_validator|validator.nu|html5validator|csscheck|jigsaw|newsbot|feedfetcher|rssbot|feedly|inoreader|shoppingbot|pricebot|shopify|uptimerobot|pingdom|monitor|statuspage) [NC]
# Skip static files
RewriteCond %{REQUEST_URI} !\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|woff2|svg|eot)$ [NC]
# Behavior on first crawl (cache miss):
# - service.botrender.com returns 404 to the crawler and queues a render job
# - Next crawl will receive the prerendered HTML from cache
# Note: Human users are not affected; serve your app as normal.
# Proxy the request to BotRender with organization UID
RewriteRule ^(.*)$ https://service.botrender.com/%{ENV:BOTRENDER_ORG_UID}/%{HTTP_HOST}/$1 [P,L]
# Set headers for proxied requests
<IfModule mod_headers.c>
RequestHeader set X-Botrender-Token "YOUR_TOKEN"
</IfModule>
# When BotRender returns 404 (cache miss), fall back to SPA index.html
# This lets crawlers see your normal SPA on first crawl while a render job is queued
ProxyErrorOverride On
ErrorDocument 404 /index.htmlYOUR_TOKEN with your API key from Dashboard Settings