1

I have an application which consumes rss feeds (could be anything though). Users provide these feed urls and they often get 301 permanent redirects. From a best practices point of view should I be storing the original url or the new url?

I assume the latter is more appropriate given that this is the purpose of the 301 redirect (as well as 308) and this is what crawlers do?

Howiecamp
  • 2,981
  • 6
  • 38
  • 59

1 Answers1

1

I read the spec as saying to adopt the new location -- 301 Moved Permanently

Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.

Widespread browser behaviour (How long do browsers cache HTTP 301s?) is to use the new URI indefinitely:

Chrome and Firefox will cache a 301 redirect with no expiry date.

While you're asking for a general answer ("a best practices point of view"), there are reasons to retain the original URL instead (e.g., to avoid breaking with poorly-configured captive portals).

As always with HTTP, follow the spec as far as you can without creating a bad user experience in practice.

Community
  • 1
  • 1
Joe
  • 29,416
  • 12
  • 68
  • 88
  • Joe - good point about following the spec... By the way, also good point that different browsers handle this very differently. – Howiecamp Oct 11 '16 at 17:08