Martin Bean
Martin Bean

Reputation: 39389

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 serve requests from the root. I would imagine this then narrows my choices to:

Upvotes: 1

Views: 925

Answers (3)

Toto
Toto

Reputation: 2420

Code 301. After some time 410 (If you want requesters not to reference deprecated URL in their code).

Upvotes: 0

dschadlich
dschadlich

Reputation: 33

based on http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 1 would say 301, Moved Permanently

Upvotes: 2

pjmorse
pjmorse

Reputation: 9294

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.)

Upvotes: 1

Related Questions