Difference between revisions of "Ns returnmoved"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 1419)
 
m (fixup wiki formatting)
 
Line 17: Line 17:
 
: '''NOTE:''' This command is not yet part of the standard core Tcl API for AOLserver.
 
: '''NOTE:''' This command is not yet part of the standard core Tcl API for AOLserver.
  
 +
<pre>
 
   proc ns_returnmoved {url} {
 
   proc ns_returnmoved {url} {
       ns_set update [[ns_conn outputheaders]] Location $url
+
       ns_set update [ns_conn outputheaders] Location $url
       ns_return 301 "text/html" [[subst \
+
       ns_return 301 "text/html" [subst \
 
   {<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 
   {<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 
   <HTML>
 
   <HTML>
Line 28: Line 29:
 
   <H2>Moved</H2>
 
   <H2>Moved</H2>
 
   <A HREF="$url">The requested URL has moved here.</A>
 
   <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>
+
   <P ALIGN=RIGHT><SMALL><I>[ns_info name]/[ns_info patchlevel] on [ns_conn location]</I></SMALL></P>
 
   </BODY></HTML>}]
 
   </BODY></HTML>}]
 
   }
 
   }
 +
</pre>
  
 
'''EXAMPLES'''
 
'''EXAMPLES'''

Latest revision as of 14:34, 19 October 2005

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