Forward requests in your .htaccess file

Add the config snippet to your site’s .htaccess file. Uncomment the last 3 lines if you are using HTML5 pushState URLs. (Replace YOUR_API_KEY with your real API key that you got when signing up)

RewriteEngine On

Options +FollowSymLinks

# Forward requests with _escaped_fragment_ parameter to SEO.js CDN
RewriteCond %{QUERY_STRING}  _escaped_fragment_=  [NC]

RewriteRule ^(.*)${REQUEST_SCHEME}://%{HTTP_HOST}:%{SERVER_PORT}/$1 [P,QSA,L]

# Only use the following rules if you're using HTML5 pushState URLs
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule (.*) index.html [L]

Required modules

If the proxy and proxy_http modules are not already enabled, you need to enable them now. On the command line do:

$ a2enmod proxy
$ a2enmod proxy_http

Reload config

After completing these steps you’ll need to reload your Apache config:

$ sudo /etc/init.d/apache2 reload

or if you use apachectl:

$ sudo apachectl graceful

Enable AJAX crawling

To tell search engine crawlers that your site allows AJAX crawling you need to add the fragment meta tag to your HTML header.

  <meta name="fragment" content="!">

Use compatible URLs

Your URLs need to be in one of these formats:

  • /nice#!page - they are Hashbang URLs
  • /nice/page - they are HTML5 PushState URLs

Hashbang URLs are easier to implement and are compatible with older browsers, but many users find PushState URLs look more convenient.

Hash fragment URLs without the exclamation mark cannot be crawled:

  • /one#page needs to be changed to /one#!page or /one/page