What type of redirect should I be using to redirect a user to a connection page if he needs to be authenticated before using one service of my website ?
Just to be sure using the right numbers for the crawler’s to witness what a good student I am !
What type of redirect should I be using to redirect a user to a connection page if he needs to be authenticated before using one service of my website ?
Just to be sure using the right numbers for the crawler’s to witness what a good student I am !
2
Answers
Available redirection statuses:
301 Moved Permanently
302 Found
303 See Other
304 Not Modified
307 Temporary Redirect
308 Permanent Redirect
Statuses
305 Use Proxy
and306 (Unused)
are respectively deprecated and no longer used.So by default, I would choose the
303 See Other
, since it’s the one that suits your needs the best.You should not redirect a user if he need to be logged in to view an URL.
This URL should shoot a 401 status with a form to let your user log in directly. And then return him the content with an HTTP 200 on the same URL.
Some information on 401 from HTTP specifications: