How can I avoid a 302 for Fetch as Bot?

Posted by CookieMonster on Pro Webmasters See other posts from Pro Webmasters or by CookieMonster
Published on 2013-10-17T02:22:42Z Indexed on 2013/10/17 16:25 UTC
Read the original article Hit count: 242

Filed under:

I originally posted this on Stackoverflow, but I believe here is a better place to ask.

My web application is very similar to notepad.cc which redirects to a randomly generated URL upon access, e.g. http://myapp.com/roTr94h4Gd. (Please note that notepad.cc is not my site.)

Probably because of this redirect feature, when I do "fetch as Google" or "fetch as Bingbot", I get a 302 and no html content. Not even a <html></html> tag.

HTTP/1.1 302 Moved Temporarily
Server: nginx/1.4.1
Date: Tue, 01 Oct 2013 04:37:37 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.4.17-1~dotdeb.1
Set-Cookie: PHPSESSID=vp99q5e5t5810e3bnnnvi6sfo2; expires=Thu, 03-Oct-2013 04:37:37 GMT; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: /roTr94h4Gd

How should I avoid 302 in this case? I suppose I could modify my site to prevent the redirect, but it is a necessary feature of my web app to generate a random URL on each access.

I added <meta name="fragment" content="!"> tag into my index page and set it to return a static snapshot of my page when the flag is set. But this still returns a 302.

I also added a header to return 200 before redirecting, but this had no effect, either.

Could someone tell me a good suggestion to solve this problem?

© Pro Webmasters or respective owner

Related posts about seo