问题原文
原帖链接 · henrywright · CC BY-SA 3.0
I have a page on my website that's targeted at logged-in users only. Logged-out visitors shouldn't see the content.
Imagine the page URL is example.com/upload/.
In cases when users aren't authenticated (logged-out), would a 301, 302 or 404 response be most appropriate? Please explain why in your answer.
已采纳解答
原帖链接 · Steve · CC BY-SA 3.0
You could use an error 401 = You are not authorised to view this page
However read this: https://stackoverflow.com/questions/3297048/403-forbidden-vs-401-unauthorized-http-responses
A 301 redirect means that the page has permanently moved to a new location.
A 302 redirect means that the move is only temporary
A 404 redirect means that the page can't be found
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
