Skip to content
  • There are no suggestions because the search field is empty.

Why is my Apache .htaccess integration with Prerender.io not detected?

The most common cause is rewrite-rule order: an earlier RewriteRule with the [L] flag terminates request processing before Prerender.io's block ever runs.

TL;DR

Apache processes RewriteRule directives sequentially. If any rule before Prerender.io's block uses [L] or otherwise terminates the request (such as a catch-all rewrite to index.html, or a port-80-to-HTTPS redirect), Prerender.io's rules never execute and AI crawlers and search engines fall through to your normal origin response. Move the Prerender.io block above any terminating rewrite. The two examples below show exactly what changes.

 

Why rule order matters

The Prerender.io RewriteRule needs to be the first one Apache evaluates that matches a bot request. If a different rewrite rule appears earlier in your .htaccess and uses the [L] ("last") flag, the request is resolved before Apache ever reaches the Prerender.io block, so AI crawlers and search engines never receive the prerendered HTML. The fix is to place the Prerender.io block above any terminating rewrite, then keep your other rules below it.

The two examples below differ only in rule order. Compare them side by side to see where the Prerender.io block needs to sit in your own .htaccess.

 

Incorrect rule order

Here is an example of a poorly ordered .htaccess configuration. The HTTPS redirect and the catch-all index.html rewrite run before the Prerender.io block, so requests are rewritten and terminated with [L] before Prerender.io ever sees them.

❗ Example of a wrong configuration order:

RewriteEngine on

# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]

<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "YOURTOKEN"
RequestHeader set X-Prerender-Version "prerender-apache@2.0.0"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On

<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp|redditbot|applebot|flipboard|tumblr|bitlybot|skypeuripreview|nuzzel|discordbot|google\ page\ speed|qwantify|bitrix\ link\ preview|xing-contenttabreceiver|chrome-lighthouse|telegrambot|Perplexity|OAI-SearchBot|ChatGPT|GPTBot|ClaudeBot|Amazonbot [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
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|\.svg))

RewriteRule ^(index\.html|index\.php)?(.*) https://service.prerender.io/%{REQUEST_SCHEME}://%{HTTP_HOST}/$2 [P,END]
</IfModule>
</IfModule>

The problem: the RewriteRule ^ index.html [L] catch-all rewrites every request to index.html and terminates rule processing with [L]. By the time Apache reaches the Prerender.io block lower down, the request has already been resolved, so the Prerender.io rules never run for bot traffic.

 

Correct rule order

In this version, the Prerender.io block is placed first, so bot requests are routed to Prerender.io before any other rewrite rule has a chance to terminate the request. Human traffic still falls through to the file-existence checks and the index.html catch-all as before.

✅ Example of a correct configuration order:

RewriteEngine on

<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "YOURTOKEN"
RequestHeader set X-Prerender-Version "prerender-apache@2.0.0"
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On

<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp|redditbot|applebot|flipboard|tumblr|bitlybot|skypeuripreview|nuzzel|discordbot|google\ page\ speed|qwantify|bitrix\ link\ preview|xing-contenttabreceiver|chrome-lighthouse|telegrambot|Perplexity|OAI-SearchBot|ChatGPT|GPTBot|ClaudeBot|Amazonbot [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
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|\.svg))

RewriteRule ^(index\.html|index\.php)?(.*) https://service.prerender.io/%{REQUEST_SCHEME}://%{HTTP_HOST}/$2 [P,END]
</IfModule>
</IfModule>

# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]

💡 The [END] flag on the Prerender.io RewriteRule stops all further rule processing (unlike [L], which only ends the current pass). Once Prerender.io's rule matches a bot request and proxies to service.prerender.io, no later rule in your .htaccess can interfere with the response.

How to verify the fix

After updating .htaccess, send a bot-emulated request and check the response headers:

curl -A Googlebot -I https://www.example.com

Look for the x-prerender-requestid response header. If it is present, the integration is correctly routing bot traffic to Prerender.io. If it is missing, the rule order is still wrong or another rewrite further down is interfering.

✅ Your Apache integration is working when the Googlebot curl returns an x-prerender-requestid response header and new entries appear under CDN Analytics in your Prerender.io dashboard within a few minutes.

Get support

If you have reordered the rules and the integration still isn't detected:

To help us resolve your issue as quickly as possible, please include:

  • The full .htaccess file (or the rewrite-related section).
  • The response headers from a Googlebot-emulated curl request.
  • Your Apache version and whether mod_headers, mod_rewrite, and mod_proxy_http are all enabled (a2enmod headers proxy proxy_http on Debian/Ubuntu).
  • Whether anything sits in front of Apache (CDN, reverse proxy, load balancer) that might add its own rewrites.

Sharing these details up front helps our team diagnose the problem and get you back on track faster.

 

Related articles

💬 Still need help?
If the rule order looks right but bot requests still aren't routed to Prerender.io, our support team can dig into your .htaccess with you.
→ Contact us at support@prerender.io

 

Was this article helpful?