开发者

Why meta refresh followed by 2 redirects?

I have encountered several web开发者_如何学运维sites where the initial visit by a user results in a http-equiv refresh to another (usually gibberish) url, which then promptly redirects (302) to another gibberish url, which in turn immediately redirects to yet a fourth url that actually displays the landing page for the site.

My question is: what the heck? Why would a server be set up to behave this way?

Here is list of a few sites that do this:

  • New York State Library - http://nysl.nysed.gov
  • New York State Regulations provided by Westlaw - http://government.westlaw.com/linkedslice/default.asp?SP=nycrr-1000


A reason is that the actual content is stored in a CMS that is only reachable via an awkward URL scheme (think http://en.wikipedia.org/w/index.php?title=Cookie).

http-equiv redirects are used when you do not have control over the webserver (by means of .htaccess, PHP header(), or otherwise) to emit a 302 in the first place.

Sites also grow historically and people are lazy to update links. Consider page A, B, C. A is a redirect to B. Now some major event happens (say, product gets obsolete) and the web master just makes B a redirect to C. Now A is essentially a double indirection to C. This is how things can accumulate. Especially if you have lots of A-like pages, updating them all to point at C may be time-consuming.

Other than that the base case is that the admin was personally incapable to set up behind-the-scenes URL rewriting. (The page is reachable via the easier http://en.wikipedia.org/wiki/Cookie.)

Or maybe it is that IIS just does not have something as brilliant as mod_rewrite.

Either way, there is no excuse for more than one redirect on the main page. Especially since browsers may stop after a few redirects even if there is no loop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜