Is it possible for a user or a web-crawler to see the contents/source code of a webdocument that is automatically redirected to another page via a 301 redirect?
If it is possible? How could a user see the contents of a webdocument?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
It's theoretically possible, but no current and common web crawlers and browsers take advantage of this, and neither do most servers.
A 301 response does have a HTTP body (i.e. a document), but it's only ever used by clients that don't support or ignore redirects. Browsers and search engine crawlers do support redirects and will completely ignore the body sent by the server.
Using a telnet client, you can see the raw response from the server:
$ telnet google.com 80 Trying 184.108.40.206... Connected to google.com. Escape character is '^]'. GET / HTTP/1.1 Host: google.com HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Referrer-Policy: no-referrer Location: http://www.google.fi/?gfe_rd=cr&ei=19l5WYzCMMqq8wfX84ngBA Content-Length: 258 Date: Thu, 27 Jul 2017 12:17:27 GMT <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>302 Moved</TITLE></HEAD><BODY> <H1>302 Moved</H1> The document has moved <A HREF="http://www.google.fi/?gfe_rd=cr&ei=19l5WYzCMMqq8wfX84ngBA">here</A>. </BODY></HTML>
Another "issue" is that the server usually sends a completely different document than the original page. E.g. the above is not the homepage of http://google.com/ but a page that is automatically generated by the server.
Theoretically, you could make your server send the old page in the redirects and build a web-crawler that would look at the HTTP body in redirects. But why would you?, it seems pointless.