My site is a single page application built using AngularJS. My aim is to make it crawl-able (https://developers.google.com/webmasters/ajax-crawling/docs/specification).

This is what I have been using:-

  • Pages without hash fragments
  • AngularJS configured to use HTML5 URLs
  • <meta name="fragment" content="!" /> inserted to the head

As mentioned in the specification, using the above method, crawler is able to read my URL,

www.domainname.com as www.domainname.com?_escaped_fragment_=

My URL looks like this:


Forwarded the request if request include _escaped_fragment_ to my htmlfiles directory

RewriteEngine On

Options +FollowSymLinks

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=$                              
RewriteRule ^(.*)$ /htmlfiles/index.html? [NC,L]  

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /htmlfiles/%1.html? [NC,L]

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

With the above rewrites desired html files were able to be obtained as follows:-

www.domainname.com?_escaped_fragment_= receives www.domainname.com/htmlfiles/index.html


www.domainname.com/?_escaped_fragment_=about receives www.domainname.com/htmlfiles/about.html

Note: these tests were carried out by disabling javascript on browser

The sitemap submitted to Google is as shown:



What Google did is that it only index my main page www.domainname.com correctly. However it does not index other pages, in this case, www.domainname.com/about.

  • I could tell you to make your rewriterules more loose so it matches the escaped fragment parameter anywhere in the query string instead of depending on the query string being equal to the parameter, but google might decide not to index the about page for violating its webmaster guidelines. Do you have the actual URL to the about page? May 8 '15 at 2:49
  • You definitely get an A++ for research and detail!! I wish I had an answer for you.
    – closetnoc
    May 8 '15 at 2:49
  • Found it! Thanks all for replying. @Mike you were right about my rewrite rules. Changed it and it indexed fine.
    – wfaa
    May 8 '15 at 10:08
  • You might want to reconsider this strategy... seroundtable.com/google-ajax-deprecating-20218.html May 8 '15 at 16:35
  • @DavidGarcia Thanks for the link. Then, how should we do SEO for ajax based web application like AngularJS? May 9 '15 at 3:27

It's impossible to tell without looking at your site, but I think you're using the AJAX crawling scheme incorrectly.

If you have http://example.com/about and add the fragment meta tag to that page (so when you curl http://example.com/about it returns the meta tag in the response), then the URL that would be fetched for indexing would be http://example.com/about?_escaped_fragment_= , not http://example.com/?_escaped_fragment_=about .


Consider using HTML5, CSS3, and pushstate. Here are a few resources and examples:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.