Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am working on an AJAX site and have successfully implemented Google's AJAX recommendation by creating _escape_fragment_ versions of each page for it to index.

Thus each page has 2 URLs:

  • pretty: example.com#!blog
  • ugly: example.com?_escaped_fragment_=blog

However, I have noticed in my analytics that some users are arriving on the site via the "ugly" URL and am looking for a clean way to redirect them to the pretty URL without impacting Google's ability to index the site.

I have considered using a 301 redirect in the head but fear that Googlebot might try to follow it and end up in an endless loop.

I have also considered using a JavaScript redirect that Googlebot wouldn't execute but fear that Google may interpret this as cloaking and penalize the website.

Is there a good, clean, acceptable way to redirect real users away from the ugly URL if for some reason or another they end up arriving at the site that way?

share|improve this question
3  
Out of curiosity, how do users users appear to find the escaped fragment URL? –  Stephen Ostermiller Jan 12 at 12:36
add comment

2 Answers 2

I have also considered using a JavaScript redirect that Googlebot wouldn't execute but fear that Google may interpret this as cloaking and penalize the website.

I would still use the JavaScript redirect approach. I don't think it would be considered cloaking because:

  • You show that JavaScript to all user agents (cloaking is doing something special just for Googlebot).
  • The same content gets shown at the target of the redirect (so you are not doing anything sneaky).
share|improve this answer
add comment

Make sure that both the pages have the pretty URL as there canonical URL

e.g. a tag in the header like

Then you don't really need to worry as Google will take both the pages as the same and only index and show the one with the nice URL, but combine all the nice link juice.

See https://support.google.com/webmasters/answer/139066?hl=en

For the end users then teh only real way is a 301. If you use a 301 if shouldn't cause a loop if you redirect from the ugly to the pretty.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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