.htaccess for SEO bots crawling single page applications WITHOUT hashbangs
1,106 views
Skip to first unread message
Daniel Kanze
unread,
Jul 29, 2013, 11:55:04 AM7/29/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ang...@googlegroups.com
Using a `pushState` enabled page, normally you redirect SEO bots using the `escaped_fragment` convention. You can read more about that **[here][1]**.
The convention assumes that you will be using a (!#) hashbang prefix before all of your URI's on a single page application. SEO bots will escape these fragments by replacing the hashbang with it's own recognizable convention escaped_fragment when making a page request.
The problem is that the hashbang is getting phased out quickly with the widely adapted pushState support. It's also really ugly and isn't very intuitive to a user.
So what if we used HTML5 mode where pushState guides the *entire* user application?
Can rewrite rules guide bots to your cached version using this newer convention? [Related but only accounts for index edge case.][2] Google also **[has an article][3]** that suggests using an *opt-in* method for this single edge case using <meta name="fragment" content="!"> in the <head> of the page. Again, this is for a single edge case. Here we are talking about handling every page as an *opt-in* senario.
I'm thinking that the `escaped_fragment` could still be used as an identifier for SEO bots, and that I could extract everything inbetween the the domain and this identifier to append to my bucket location like:
Not sure if there's a better solution, but it's working for me so far. Just be sure to have the directory structure for your snapshots match the URL structure.
On Monday, July 29, 2013 11:55:04 AM UTC-4, Daniel Kanze wrote: