0

I have an AJAX site and I'm using hashbangs (#!) in my urls with the intention of then providing the correct HTML versions when google bots replace the #! with ?_escaped_fragment_.

How do I go about routing/proxying/redirecting the url with _escaped_fragment_ to the corresponding HTML pages? I can't find documentation on this part of the process specifically, and my first thought was that I should be using a 301 or 302 redirect, but I was told that wasn't the case, albeit not given any more info.

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
Eric
  • 2,004
  • 6
  • 23
  • 33
  • It depends on your server, your choice of server side programming language (and framework if you are using one) and personal preference. – Quentin Feb 22 '15 at 16:35
  • You [shouldn't use hashbangs](http://isolani.co.uk/blog/javascript/BreakingTheWebWithHashBangs) though, they've been superseded by [the history API](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history). – Quentin Feb 22 '15 at 16:36

1 Answers1

-2

You can't use htaccess or redirects at all. Everything after the # in the URL isn't even sent to the server. The URL fragment is entirely client side. You'll need to use some kind of javascript solution to look at the fragment, and make whatever appropriate AJAX call to the server and load the content you get back.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • The question is asking about when Googlebot replaces the `#` with `?_escaped_fragment_`, not when a regular browser goes to the URL with the fragment id in it. – Quentin Feb 22 '15 at 16:34