Okay so if you go to the documentations here: https://docs.djangoproject.com/en/dev/topics/http/shortcuts/
and scroll down to look at the last example of redirect() it says "By default, redirect() returns a temporary redirect. All of the above forms accept a permanent argument; if set to True a permanent redirect will be returned:"
Now, what's the difference between a temporary redirect and a permanent redirect? I'm using it so that, when a user logs in and is authenticated, then to redirect him to the logged in page. Should I be using HttpResponseRedirect() instead? Does it give any benefit of using redirect() instead of HttpResponseRedirect()?
Just adding a note to Brandon's post concerning your question what is the difference between both. The major difference between temporary and permanent redirects is how third parties see it. If Google sees a permanent redirect it would probably think that the old site is gone and would update all hits to directly access the new URL. Some people say that Google favors permanent redirects as temporary redirects are often used by spammers.
A case for temporary redirects are e.g. internal rewritings of URLs on your own site that link to a download mirror/static file server. In this case the redirecting site will probably stay the same while the other server address might change (e.g. host static content wherever it is cheapest). Using permanent redirects might introduce problems (think about podcast players on your phone that remember such redirects and won't recognize it when you move your static file server).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With