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

Apache Integration Guide

This guide explains how to serve fully rendered HTML pages to search engine crawlers by configuring Apache with the necessary modules and rewrite rules. It enables bot traffic to be routed to Prerender.io without requiring changes to your frontend code.

View source on GitHub.

You can find the Apache config here.

 

Video guide:

Prerender token

The location of the Prerender token has changed. You can find it under the Security and Access menu under Prerender Token.

 

You can find the required codes in the section of the text guide below.

Text guide:

  1. Enable the required modules.
    1. In Ubuntu and other Debian based systems you might need to use the commands below:
      sudo a2enmod headers
      sudo a2enmod proxy
      sudo a2enmod proxy_http
      sudo a2enmod ssl
      sudo a2enmod rewrite
      Some modules might be already enabled however if a new module is enabled its recommended to restart Apache. (You can usually do that with either the service apache2 restart command)
    2. In other systems you will need to uncomment or add these lines to the webserver's config file in httpd.conf.
      LoadModule headers_module libexec/apache2/mod_headers.so
      LoadModule proxy_module libexec/apache2/mod_proxy.so
      LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
      LoadModule ssl_module libexec/apache2/mod_ssl.so
      LoadModule rewrite_module libexec/apache2/mod_rewrite.so
  2. Add the following lines at the bottom of your site's Apache vhost config in the 443 block.
    It's recommended ot make a backup from the file first.
    # === Prerender.io Configuration ===

    # Enable proxying over HTTPS

    SSLProxyEngine on

    # The lines below disable SSL certificate verification.

    # Only uncomment these if you're testing with a local Prerender server using a self-signed certificate.

    # For the hosted Prerender service, these should remain commented as it uses a valid SSL certificate.

    # SSLProxyCheckPeerName off

    # SSLProxyVerify none

     

  3. Add the following lines at the top of your .htaccess file. Which is usually located in your site's root directory. It's recommended ot make a backup from the file first.
    # === Prerender.io Rewrite Configuration ===

    # Replace "YOUR_TOKEN" with your actual Prerender token

    # When testing with a local Prerender server, replace the endpoint

    # https://service.prerender.io/ with http://localhost:3000/

    <IfModule mod_headers.c>

        RequestHeader set X-Prerender-Token "YOUR_TOKEN"

        RequestHeader set X-Prerender-Version "prerender-apache@2.0.0"

    </IfModule>

    <IfModule mod_rewrite.c>

        RewriteEngine On

        <IfModule mod_proxy_http.c>

            # Target known bots and crawlers

            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|skypeu_

     

  4. Add your Prerender token. Make sure to replace the YOUR_TOKEN place holder with your Prerender.io Token from the Security and Access menu.

  5. Restart Apache so that the config change can take effect.
    You can do that usually with either service apache2 restart or with service httpd restart

 

Troubleshooting Tip:
To ensure the Apache .htaccess integration with Prerender works correctly, place the Prerender rewrite rules at the very top of your .htaccess file.

Any rewrite rule above that uses the [L] (last) flag will stop further processing, which can prevent Prerender from handling requests properly.

Get full details here.

 


 

Verify Your Installation

After integration, it’s important to verify that everything is working as expected. We’ve provided an easy-to-follow guide to help you test your setup and confirm that Prerender is functioning properly.

 

Is the Prerender integration working on other pages?

Test if the Prerender integration works on the other pages based on this guide: Verify the integration

If you don't see the Prerender headers / IDs, then the Integration is not working, which might be why the other URL is not cached. 

 

Getting an Error?

If you see the message "Prerender Integration Not Detected," you can refer to the troubleshooting guide here to help resolve the issue.

 

Expert Assistance

For those who need additional help or want to ensure a smooth and secure launch, we offer a specialized package:

Kickstart Package

Price: $800 (one-time payment)

This one-time package empowers you with expert setup and configuration, ensuring a smooth and secure launch.

Features:

  • Three setup and configuration sessions with our experts
  • Onboarding assistance
  • Security assessment

To learn more about this package or to purchase, visit the Packages section under the Billing menu in your Prerender dashboard. 


 

Get Support

If you're still encountering issues after implementing Prerender:

  • Review your implementation against our documentation
  • Contact our support team:

To help us resolve your issue as quickly as possible, please gather and include any relevant information, such as:

  • Error messages you're seeing
  • Steps you've already taken to troubleshoot
  • Screenshots or screen recordings (if applicable)

Providing these details up front will help our team diagnose the problem more efficiently and get you back on track faster.

 

Related Articles / FAQs: