ad_returnredirect {-permanent 0} target_urlWhat it does:
A replacement for ns_returnredirect. It uses ns_returnredirect but is better in three important aspects:Defined in: /web/philip/packages/acs-core/utilities-procs.tcl
- When the supplied target_url isn't complete, (e.g. /foo/bar.tcl or foo.tcl) the prepended location part is constructed by looking at the HTTP 1.1 Host header.
- If an URL relative to the current directory is supplied (e.g. foo.tcl) it prepends location and directory.
- Setting -permanent to a true value generates a 301 redirect.
Source code:
arg_parser_for_ad_returnredirect $args if $permanent { if {[util_complete_url_p $target_url]} { # http://myserver.com/foo/bar.tcl style - just pass to ns_returnredirect permanently_redirect $target_url } elseif {[util_absolute_path_p $target_url]} { # /foo/bar.tcl style - prepend the current location: permanently_redirect [util_current_location]$target_url } else { # URL is relative to current directory. permanently_redirect [util_current_location][util_current_directory]$target_url } } else { if {[util_complete_url_p $target_url]} { # http://myserver.com/foo/bar.tcl style - just pass to ns_returnredirect ns_returnredirect $target_url } elseif {[util_absolute_path_p $target_url]} { # /foo/bar.tcl style - prepend the current location: ns_returnredirect [util_current_location]$target_url } else { # URL is relative to current directory. ns_returnredirect [util_current_location][util_current_directory]$target_url } }