Where The Streets Have No Name

HTTP status code 처리 본문

Developement/RIA

HTTP status code 처리

highheat 2006. 8. 14. 11:05

Example 1


public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

  response.sendError(response.SC_MOVED_PERMANENTLY, "/newUserLogin.do");
}


Example 2

In Active Server Page (ASP) with VBScript, developers can use Response.Redirect.

Response.Redirect "newUserLogin.asp"

or

Response.Redirect("newUserLogin.asp")

The code below is a more complete example with a specific HTTP status code.

Response.Clear
Response.Status = 301
Response.AddHeader "Location", "newUserLogin.asp"
Response.Flush
Response.End

Example 3

<?php
header("HTTP/1.1 301 Moved Permanently);
header("Location:
http://www.example.com/newUserLogin.php");
?>