: Best way to redirect users back to the pretty URL who land on the _escaped_fragment_ one? I am working on an AJAX site and have successfully implemented Google's AJAX recommendation by creating
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?
More posts by @Angela700
3 Comments
Sorted by latest first Latest Oldest Best
The appropriate way to do this is to use the the rel=canonical attribute on your page. This will identify one source URL for your content.
For example:
<link rel="canonical" href="http://blog.example.com/dresses/green-dresses-are-awesome" />
Google acknowledges this issue in a write up found here: support.google.com/webmasters/answer/139066?hl=en
It basically explains that they expect multiple URLs, but they also would prefer that the webmaster indicate the best URL for a given page.
You should not need to redirect at this point, but if it is for aesthetic reasons, use a non-permanent redirect, such as a 302 or 303 redirect.
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 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.
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).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.