What's the best HTTP status code for a redirect from / to /home?
I have a web application where the requested URL is used in a REST-like fashion. However, if no URL is entered (just the domain) I re-direct to http://www.example.com/home
and then my home controller is loaded.
What HTTP status code should I use for this re-direct? This process takes place in my index.php
script using a simple header('Location: home')
call.
Clarification: this may not be permanent, but will remain present in this version of the application. So for example, if this application were to be redeveloped in the future then the new developer may chose to once again serv开发者_运维知识库e requests from the root. I would imagine this then narrows my choices to:
303 See Other
307 Moved Temporarily
based on http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 1 would say 301, Moved Permanently
I'd favor 302 "Found" for this use; that tells the user-agent that they can/should continue requesting /
in the future because someday the redirect might be different. (But I could make a case for 301 "Moved Permanently", too.)
Code 301. After some time 410 (If you want requesters not to reference deprecated URL in their code).
精彩评论