blob: 24c7e259f2ee1d3edf7e9d2e90ddb5984fb6df5b [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001##########
2URL Helper
3##########
4
5The URL Helper file contains functions that assist in working with URLs.
6
Derek Jonesabbf5182013-07-19 16:01:52 -07007.. contents::
8 :local:
9
10.. raw:: html
11
12 <div class="custom-index container"></div>
Derek Jones8ede1a22011-10-05 13:34:52 -050013
14Loading this Helper
15===================
16
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020017This helper is loaded using the following code::
Derek Jones8ede1a22011-10-05 13:34:52 -050018
19 $this->load->helper('url');
20
21The following functions are available:
22
Derek Jonesabbf5182013-07-19 16:01:52 -070023Available Functions
24===================
Derek Jones8ede1a22011-10-05 13:34:52 -050025
Derek Jonesabbf5182013-07-19 16:01:52 -070026.. function:: site_url([$uri = ''[, $protocol = NULL]])
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020027
28 :param string $uri: URI string
Andrey Andreev2023c3d2013-07-18 03:19:59 +030029 :param string $protocol: Protocol, e.g. 'http' or 'https'
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020030 :returns: string
31
Derek Jonesabbf5182013-07-19 16:01:52 -070032 Returns your site URL, as specified in your config file. The index.php
33 file (or whatever you have set as your site **index_page** in your config
34 file) will be added to the URL, as will any URI segments you pass to the
35 function, plus the **url_suffix** as set in your config file.
Derek Jones8ede1a22011-10-05 13:34:52 -050036
Derek Jonesabbf5182013-07-19 16:01:52 -070037 You are encouraged to use this function any time you need to generate a
38 local URL so that your pages become more portable in the event your URL
39 changes.
Derek Jones8ede1a22011-10-05 13:34:52 -050040
Derek Jonesabbf5182013-07-19 16:01:52 -070041 Segments can be optionally passed to the function as a string or an
42 array. Here is a string example::
Derek Jones8ede1a22011-10-05 13:34:52 -050043
Derek Jonesabbf5182013-07-19 16:01:52 -070044 echo site_url('news/local/123');
Derek Jones8ede1a22011-10-05 13:34:52 -050045
Derek Jonesabbf5182013-07-19 16:01:52 -070046 The above example would return something like:
47 *http://example.com/index.php/news/local/123*
Derek Jones8ede1a22011-10-05 13:34:52 -050048
Derek Jonesabbf5182013-07-19 16:01:52 -070049 Here is an example of segments passed as an array::
Derek Jones8ede1a22011-10-05 13:34:52 -050050
Derek Jonesabbf5182013-07-19 16:01:52 -070051 $segments = array('news', 'local', '123');
52 echo site_url($segments);
Derek Jones8ede1a22011-10-05 13:34:52 -050053
Derek Jonesabbf5182013-07-19 16:01:52 -070054 This function is an alias for ``CI_Config::site_url()``. For more info,
55 please see the :doc:`Config Library <../libraries/config>` documentation.
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020056
Derek Jones8ede1a22011-10-05 13:34:52 -050057
Derek Jonesabbf5182013-07-19 16:01:52 -070058
59.. function:: base_url($uri = '', $protocol = NULL)
Derek Jones8ede1a22011-10-05 13:34:52 -050060
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020061 :param string $uri: URI string
Andrey Andreev2023c3d2013-07-18 03:19:59 +030062 :param string $protocol: Protocol, e.g. 'http' or 'https'
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020063 :returns: string
64
Derek Jonesabbf5182013-07-19 16:01:52 -070065 Returns your site base URL, as specified in your config file. Example::
Derek Jones8ede1a22011-10-05 13:34:52 -050066
Derek Jonesabbf5182013-07-19 16:01:52 -070067 echo base_url();
Derek Jones8ede1a22011-10-05 13:34:52 -050068
Derek Jonesabbf5182013-07-19 16:01:52 -070069 This function returns the same thing as :func:`site_url()`, without
70 the *index_page* or *url_suffix* being appended.
Derek Jones8ede1a22011-10-05 13:34:52 -050071
Derek Jonesabbf5182013-07-19 16:01:52 -070072 Also like :func:`site_url()`, you can supply segments as a string or
73 an array. Here is a string example::
Derek Jones8ede1a22011-10-05 13:34:52 -050074
Derek Jonesabbf5182013-07-19 16:01:52 -070075 echo base_url("blog/post/123");
Derek Jones8ede1a22011-10-05 13:34:52 -050076
Derek Jonesabbf5182013-07-19 16:01:52 -070077 The above example would return something like:
78 *http://example.com/blog/post/123*
Derek Jones8ede1a22011-10-05 13:34:52 -050079
Derek Jonesabbf5182013-07-19 16:01:52 -070080 This is useful because unlike :func:`site_url()`, you can supply a
81 string to a file, such as an image or stylesheet. For example::
Derek Jones8ede1a22011-10-05 13:34:52 -050082
Derek Jonesabbf5182013-07-19 16:01:52 -070083 echo base_url("images/icons/edit.png");
Derek Jones8ede1a22011-10-05 13:34:52 -050084
Derek Jonesabbf5182013-07-19 16:01:52 -070085 This would give you something like:
86 *http://example.com/images/icons/edit.png*
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020087
Derek Jonesabbf5182013-07-19 16:01:52 -070088 This function is an alias for ``CI_Config::base_url()``. For more info,
89 please see the :doc:`Config Library <../libraries/config>` documentation.
Derek Jones8ede1a22011-10-05 13:34:52 -050090
Derek Jones8ede1a22011-10-05 13:34:52 -050091
Derek Jonesabbf5182013-07-19 16:01:52 -070092.. function:: current_url()
Andrey Andreev08f0f8b2012-11-09 10:27:43 +020093
94 :returns: string
95
Derek Jonesabbf5182013-07-19 16:01:52 -070096 Returns the full URL (including segments) of the page being currently
97 viewed.
Derek Jones8ede1a22011-10-05 13:34:52 -050098
Derek Jonesabbf5182013-07-19 16:01:52 -070099 .. note:: Calling this function is the same as doing this:
100 |
101 | site_url(uri_string());
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200102
Derek Jones8ede1a22011-10-05 13:34:52 -0500103
Derek Jonesabbf5182013-07-19 16:01:52 -0700104.. function:: uri_string()
Derek Jones8ede1a22011-10-05 13:34:52 -0500105
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200106 :returns: string
107
Derek Jonesabbf5182013-07-19 16:01:52 -0700108 Returns the URI segments of any page that contains this function.
109 For example, if your URL was this::
Derek Jones8ede1a22011-10-05 13:34:52 -0500110
Derek Jonesabbf5182013-07-19 16:01:52 -0700111 http://some-site.com/blog/comments/123
Derek Jones8ede1a22011-10-05 13:34:52 -0500112
Derek Jonesabbf5182013-07-19 16:01:52 -0700113 The function would return::
Derek Jones8ede1a22011-10-05 13:34:52 -0500114
Derek Jonesabbf5182013-07-19 16:01:52 -0700115 blog/comments/123
Derek Jones8ede1a22011-10-05 13:34:52 -0500116
Derek Jonesabbf5182013-07-19 16:01:52 -0700117 This function is an alias for ``CI_Config::uri_string()``. For more info,
118 please see the :doc:`Config Library <../libraries/config>` documentation.
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200119
Derek Jones8ede1a22011-10-05 13:34:52 -0500120
Derek Jonesabbf5182013-07-19 16:01:52 -0700121.. function:: index_page()
Derek Jones8ede1a22011-10-05 13:34:52 -0500122
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200123 :returns: string
124
Derek Jonesabbf5182013-07-19 16:01:52 -0700125 Returns your site **index_page**, as specified in your config file.
126 Example::
Derek Jones8ede1a22011-10-05 13:34:52 -0500127
Derek Jonesabbf5182013-07-19 16:01:52 -0700128 echo index_page();
Derek Jones8ede1a22011-10-05 13:34:52 -0500129
Derek Jones8ede1a22011-10-05 13:34:52 -0500130
Derek Jonesabbf5182013-07-19 16:01:52 -0700131.. function:: anchor($uri = '', $title = '', $attributes = '')
Derek Jones8ede1a22011-10-05 13:34:52 -0500132
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200133 :param string $uri: URI string
134 :param string $title: Anchor title
135 :param mixed $attributes: HTML attributes
136 :returns: string
Derek Jones8ede1a22011-10-05 13:34:52 -0500137
Derek Jonesabbf5182013-07-19 16:01:52 -0700138 Creates a standard HTML anchor link based on your local site URL.
Derek Jones8ede1a22011-10-05 13:34:52 -0500139
Derek Jonesabbf5182013-07-19 16:01:52 -0700140 The first parameter can contain any segments you wish appended to the
141 URL. As with the :func:`site_url()` function above, segments can
142 be a string or an array.
Derek Jones8ede1a22011-10-05 13:34:52 -0500143
Derek Jonesabbf5182013-07-19 16:01:52 -0700144 .. note:: If you are building links that are internal to your application
145 do not include the base URL (http://...). This will be added
146 automatically from the information specified in your config file.
147 Include only the URI segments you wish appended to the URL.
Derek Jones8ede1a22011-10-05 13:34:52 -0500148
Derek Jonesabbf5182013-07-19 16:01:52 -0700149 The second segment is the text you would like the link to say. If you
150 leave it blank, the URL will be used.
Derek Jones8ede1a22011-10-05 13:34:52 -0500151
Derek Jonesabbf5182013-07-19 16:01:52 -0700152 The third parameter can contain a list of attributes you would like
153 added to the link. The attributes can be a simple string or an
154 associative array.
Derek Jones8ede1a22011-10-05 13:34:52 -0500155
Derek Jonesabbf5182013-07-19 16:01:52 -0700156 Here are some examples::
Derek Jones8ede1a22011-10-05 13:34:52 -0500157
Derek Jonesabbf5182013-07-19 16:01:52 -0700158 echo anchor('news/local/123', 'My News', 'title="News title"');
159 // Prints: <a href="http://example.com/index.php/news/local/123" title="News title">My News</a>
Derek Jones8ede1a22011-10-05 13:34:52 -0500160
Derek Jonesabbf5182013-07-19 16:01:52 -0700161 echo anchor('news/local/123', 'My News', array('title' => 'The best news!'));
162 // Prints: <a href="http://example.com/index.php/news/local/123" title="The best news!">My News</a>
Derek Jones8ede1a22011-10-05 13:34:52 -0500163
Derek Jonesabbf5182013-07-19 16:01:52 -0700164 echo anchor('', 'Click here');
165 // Prints: <a href="http://example.com">Click Here</a>
Derek Jones8ede1a22011-10-05 13:34:52 -0500166
Derek Jones8ede1a22011-10-05 13:34:52 -0500167
Derek Jonesabbf5182013-07-19 16:01:52 -0700168.. function:: anchor_popup($uri = '', $title = '', $attributes = FALSE)
Derek Jones8ede1a22011-10-05 13:34:52 -0500169
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200170 :param string $uri: URI string
171 :param string $title: Anchor title
172 :param mixed $attributes: HTML attributes
173 :returns: string
174
Derek Jonesabbf5182013-07-19 16:01:52 -0700175 Nearly identical to the :func:`anchor()` function except that it
176 opens the URL in a new window. You can specify JavaScript window
177 attributes in the third parameter to control how the window is opened.
178 If the third parameter is not set it will simply open a new window with
179 your own browser settings.
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200180
Derek Jonesabbf5182013-07-19 16:01:52 -0700181 Here is an example with attributes::
Derek Jones8ede1a22011-10-05 13:34:52 -0500182
Derek Jonesabbf5182013-07-19 16:01:52 -0700183 $atts = array(
184 'width' => 800,
185 'height' => 600,
186 'scrollbars' => 'yes',
187 'status'      => 'yes',
188 'resizable'   => 'yes',
189 'screenx' => 0,
190 'screeny' => 0,
191 'window_name' => '_blank'
192 );
Derek Jones8ede1a22011-10-05 13:34:52 -0500193
Derek Jonesabbf5182013-07-19 16:01:52 -0700194 echo anchor_popup('news/local/123', 'Click Me!', $atts);
Derek Jones8ede1a22011-10-05 13:34:52 -0500195
Derek Jonesabbf5182013-07-19 16:01:52 -0700196 .. note:: The above attributes are the function defaults so you only need to
197 set the ones that are different from what you need. If you want the
198 function to use all of its defaults simply pass an empty array in the
199 third parameter:
200 |
201 | echo anchor_popup('news/local/123', 'Click Me!', array());
Derek Jones8ede1a22011-10-05 13:34:52 -0500202
Derek Jonesabbf5182013-07-19 16:01:52 -0700203 .. note:: The **window_name** is not really an attribute, but an argument to
204 the JavaScript `window.open() <http://www.w3schools.com/jsref/met_win_open.asp>`
205 method, which accepts either a window name or a window target.
Andrey Andreev81c32082012-06-16 21:21:46 +0300206
Derek Jonesabbf5182013-07-19 16:01:52 -0700207 .. note:: Any other attribute than the listed above will be parsed as an
208 HTML attribute to the anchor tag.
Andrey Andreev81c32082012-06-16 21:21:46 +0300209
Derek Jones8ede1a22011-10-05 13:34:52 -0500210
Derek Jonesabbf5182013-07-19 16:01:52 -0700211.. function:: mailto($email, $title = '', $attributes = '')
Derek Jones8ede1a22011-10-05 13:34:52 -0500212
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200213 :param string $email: E-mail address
214 :param string $title: Anchor title
215 :param mixed $attributes: HTML attributes
216 :returns: string
217
Derek Jonesabbf5182013-07-19 16:01:52 -0700218 Creates a standard HTML e-mail link. Usage example::
Derek Jones8ede1a22011-10-05 13:34:52 -0500219
Derek Jonesabbf5182013-07-19 16:01:52 -0700220 echo mailto('me@my-site.com', 'Click Here to Contact Me');
Derek Jones8ede1a22011-10-05 13:34:52 -0500221
Derek Jonesabbf5182013-07-19 16:01:52 -0700222 As with the :func:`anchor()` tab above, you can set attributes using the
223 third parameter::
InFog00b3df42012-07-29 13:42:50 -0300224
Derek Jonesabbf5182013-07-19 16:01:52 -0700225 $attributes = array('title' => 'Mail me');
226 echo mailto('me@my-site.com', 'Contact Me', $attributes);
Derek Jones8ede1a22011-10-05 13:34:52 -0500227
Derek Jones8ede1a22011-10-05 13:34:52 -0500228
Derek Jonesabbf5182013-07-19 16:01:52 -0700229.. function:: safe_mailto($email, $title = '', $attributes = '')
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200230
231 :param string $email: E-mail address
232 :param string $title: Anchor title
233 :param mixed $attributes: HTML attributes
234 :returns: string
235
Derek Jonesabbf5182013-07-19 16:01:52 -0700236 Identical to the :func:`mailto()` function except it writes an obfuscated
237 version of the *mailto* tag using ordinal numbers written with JavaScript to
238 help prevent the e-mail address from being harvested by spam bots.
Derek Jones8ede1a22011-10-05 13:34:52 -0500239
Derek Jones8ede1a22011-10-05 13:34:52 -0500240
Derek Jonesabbf5182013-07-19 16:01:52 -0700241.. function:: auto_link($str, $type = 'both', $popup = FALSE)
Derek Jones8ede1a22011-10-05 13:34:52 -0500242
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200243 :param string $str: Input string
244 :param string $type: Link type ('email', 'url' or 'both')
245 :param bool $popup: Whether to create popup links
246 :returns: string
247
Derek Jonesabbf5182013-07-19 16:01:52 -0700248 Automatically turns URLs and e-mail addresses contained in a string into
249 links. Example::
Derek Jones8ede1a22011-10-05 13:34:52 -0500250
Derek Jonesabbf5182013-07-19 16:01:52 -0700251 $string = auto_link($string);
Derek Jones8ede1a22011-10-05 13:34:52 -0500252
Derek Jonesabbf5182013-07-19 16:01:52 -0700253 The second parameter determines whether URLs and e-mails are converted or
254 just one or the other. Default behavior is both if the parameter is not
255 specified. E-mail links are encoded as :func:`safe_mailto()` as shown
256 above.
Derek Jones8ede1a22011-10-05 13:34:52 -0500257
Derek Jonesabbf5182013-07-19 16:01:52 -0700258 Converts only URLs::
Derek Jones8ede1a22011-10-05 13:34:52 -0500259
Derek Jonesabbf5182013-07-19 16:01:52 -0700260 $string = auto_link($string, 'url');
Derek Jones8ede1a22011-10-05 13:34:52 -0500261
Derek Jonesabbf5182013-07-19 16:01:52 -0700262 Converts only e-mail addresses::
Derek Jones8ede1a22011-10-05 13:34:52 -0500263
Derek Jonesabbf5182013-07-19 16:01:52 -0700264 $string = auto_link($string, 'email');
Derek Jones8ede1a22011-10-05 13:34:52 -0500265
Derek Jonesabbf5182013-07-19 16:01:52 -0700266 The third parameter determines whether links are shown in a new window.
267 The value can be TRUE or FALSE (boolean)::
Derek Jones8ede1a22011-10-05 13:34:52 -0500268
Derek Jonesabbf5182013-07-19 16:01:52 -0700269 $string = auto_link($string, 'both', TRUE);
Derek Jones8ede1a22011-10-05 13:34:52 -0500270
Derek Jones8ede1a22011-10-05 13:34:52 -0500271
Derek Jonesabbf5182013-07-19 16:01:52 -0700272.. function:: url_title($str, $separator = '-', $lowercase = FALSE)
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200273
274 :param string $str: Input string
275 :param string $separator: Word separator
276 :param string $lowercase: Whether to transform the output string to lower-case
277 :returns: string
278
Derek Jonesabbf5182013-07-19 16:01:52 -0700279 Takes a string as input and creates a human-friendly URL string. This is
280 useful if, for example, you have a blog in which you'd like to use the
281 title of your entries in the URL. Example::
Derek Jones8ede1a22011-10-05 13:34:52 -0500282
Derek Jonesabbf5182013-07-19 16:01:52 -0700283 $title = "What's wrong with CSS?";
284 $url_title = url_title($title);
285 // Produces: Whats-wrong-with-CSS
Derek Jones8ede1a22011-10-05 13:34:52 -0500286
Derek Jonesabbf5182013-07-19 16:01:52 -0700287 The second parameter determines the word delimiter. By default dashes
288 are used. Preferred options are: **-** (dash) or **_** (underscore)
Derek Jones8ede1a22011-10-05 13:34:52 -0500289
Derek Jonesabbf5182013-07-19 16:01:52 -0700290 Example::
Derek Jones8ede1a22011-10-05 13:34:52 -0500291
Derek Jonesabbf5182013-07-19 16:01:52 -0700292 $title = "What's wrong with CSS?";
293 $url_title = url_title($title, 'underscore');
294 // Produces: Whats_wrong_with_CSS
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200295
Derek Jonesabbf5182013-07-19 16:01:52 -0700296 .. note:: Old usage of 'dash' and 'underscore' as the second parameter
297 is DEPRECATED.
Derek Jones8ede1a22011-10-05 13:34:52 -0500298
Derek Jonesabbf5182013-07-19 16:01:52 -0700299 The third parameter determines whether or not lowercase characters are
300 forced. By default they are not. Options are boolean TRUE/FALSE.
Derek Jones8ede1a22011-10-05 13:34:52 -0500301
Derek Jonesabbf5182013-07-19 16:01:52 -0700302 Example::
Derek Jones8ede1a22011-10-05 13:34:52 -0500303
Derek Jonesabbf5182013-07-19 16:01:52 -0700304 $title = "What's wrong with CSS?";
305 $url_title = url_title($title, 'underscore', TRUE);
306 // Produces: whats_wrong_with_css
Derek Jones8ede1a22011-10-05 13:34:52 -0500307
Derek Jones8ede1a22011-10-05 13:34:52 -0500308
Derek Jonesabbf5182013-07-19 16:01:52 -0700309.. function:: prep_url($str = '')
Derek Jones8ede1a22011-10-05 13:34:52 -0500310
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200311 :param string $str: URL string
312 :returns: string
Derek Jones8ede1a22011-10-05 13:34:52 -0500313
Derek Jonesabbf5182013-07-19 16:01:52 -0700314 This function will add http:// in the event that a protocol prefix
315 is missing from a URL.
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200316
Derek Jonesabbf5182013-07-19 16:01:52 -0700317 Pass the URL string to the function like this::
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200318
Derek Jonesabbf5182013-07-19 16:01:52 -0700319 $url = prep_url('example.com');
Derek Jones8ede1a22011-10-05 13:34:52 -0500320
Derek Jones8ede1a22011-10-05 13:34:52 -0500321
Derek Jonesabbf5182013-07-19 16:01:52 -0700322.. function:: redirect($uri = '', $method = 'auto', $code = NULL)
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200323
324 :param string $uri: URI string
325 :param string $method: Redirect method ('auto', 'location' or 'refresh')
326 :param string $code: HTTP Response code (usually 302 or 303)
327 :returns: void
328
Derek Jonesabbf5182013-07-19 16:01:52 -0700329 Does a "header redirect" to the URI specified. If you specify the full
330 site URL that link will be built, but for local links simply providing
331 the URI segments to the controller you want to direct to will create the
332 link. The function will build the URL based on your config file values.
Derek Jones8ede1a22011-10-05 13:34:52 -0500333
Derek Jonesabbf5182013-07-19 16:01:52 -0700334 The optional second parameter allows you to force a particular redirection
335 method. The available methods are **auto**, **location** and **refresh**,
336 with location being faster but less reliable on IIS servers.
337 The default is **auto**, which will attempt to intelligently choose the
338 method based on the server environment.
Derek Jones8ede1a22011-10-05 13:34:52 -0500339
Derek Jonesabbf5182013-07-19 16:01:52 -0700340 The optional third parameter allows you to send a specific HTTP Response
341 Code - this could be used for example to create 301 redirects for search
342 engine purposes. The default Response Code is 302. The third parameter is
343 *only* available with **location** redirects, and not *refresh*. Examples::
Derek Jones8ede1a22011-10-05 13:34:52 -0500344
Derek Jonesabbf5182013-07-19 16:01:52 -0700345 if ($logged_in == FALSE)
346 {      
347 redirect('/login/form/');
348 }
Derek Jones8ede1a22011-10-05 13:34:52 -0500349
Derek Jonesabbf5182013-07-19 16:01:52 -0700350 // with 301 redirect
351 redirect('/article/13', 'location', 301);
Derek Jones8ede1a22011-10-05 13:34:52 -0500352
Derek Jonesabbf5182013-07-19 16:01:52 -0700353 .. note:: In order for this function to work it must be used before anything
354 is outputted to the browser since it utilizes server headers.
Derek Jones8ede1a22011-10-05 13:34:52 -0500355
Derek Jonesabbf5182013-07-19 16:01:52 -0700356 .. note:: For very fine grained control over headers, you should use the
357 `Output Library </libraries/output>` ``set_header()`` method.
vlakoff530b9462012-09-17 14:18:07 +0200358
Derek Jonesabbf5182013-07-19 16:01:52 -0700359 .. note:: To IIS users: if you hide the `Server` HTTP header, the *auto*
360 method won't detect IIS, in that case it is advised you explicitly
361 use the **refresh** method.
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200362
Derek Jonesabbf5182013-07-19 16:01:52 -0700363 .. note:: When the **location** method is used, an HTTP status code of 303
364 will *automatically* be selected when the page is currently accessed
365 via POST and HTTP/1.1 is used.
Andrey Andreev08f0f8b2012-11-09 10:27:43 +0200366
Derek Jonesabbf5182013-07-19 16:01:52 -0700367 .. important:: This function will terminate script execution.