Ns returnmoved

From AOLserver Wiki
Revision as of 14:34, 19 October 2005 by Dossy (talk | contribs) (fixup wiki formatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NAME

ns_returnmoved - Returns HTTP 301 Permanently Moved

SYNOPSIS

ns_returnmoved url

DESCRIPTION

This command redirects the client by returning a 301 (Permanently Moved) HTTP status code, and a Location header pointing at url.
NOTE: The script does not end at the time this command is invoked. ns_adp_abort or ns_adp_return should be called to end script processing after ns_returnmoved.

CODE

NOTE: This command is not yet part of the standard core Tcl API for AOLserver.
  proc ns_returnmoved {url} {
      ns_set update [ns_conn outputheaders] Location $url
      ns_return 301 "text/html" [subst \
  {<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <HTML>
  <HEAD>
  <TITLE>Moved</TITLE>
  </HEAD>
  <BODY>
  <H2>Moved</H2>
  <A HREF="$url">The requested URL has moved here.</A>
  <P ALIGN=RIGHT><SMALL><I>[ns_info name]/[ns_info patchlevel] on [ns_conn location]</I></SMALL></P>
  </BODY></HTML>}]
  }

EXAMPLES

   ns_returnmoved http://www.aolserver.com/

SEE ALSO

ns_return, ns_returnadminnotice, ns_returnbadrequest, ns_returnerror, ns_returnfile, ns_returnforbidden, ns_returnfp, ns_returnnotfound, ns_returnnotice, ns_returnok, ns_returnredirect, ns_returnunauthorized

Category Documentation