FUEL CMS User Guide : Version 1.5.2


Fuel Redirects Class

Looks at the redirects configuration for a possible match to do a HTTP redirect.

This class extends the Fuel_base_library class.

Properties Reference

Property Default Value Description
public
http_code 301 The HTTP response code to return... 301 = permanent redirect
case_sensitive 1 Determines whether the pattern matching for the redirects is case sensitive
ssl
array()
The paths to force SSL
non_ssl
array()
The paths to force NON SSL
aggressive_redirects
array()
The pages to redirect to regardless if it's found by FUEL. WARNING: Run on every request.
passive_redirects
array()
The pages to redirect to only AFTER no page is found by FUEL
max_redirects 2 Sets the number of times the page can redirect before giving nup and displaying a 404
protected
has_session N/A Used to determine if there currently is a native session being used

Function Reference [+]

$this->fuel->redirects->initialize([$params=array()])

Initialize the object and set object parameters. Accepts an associative array as input, containing object preferences.

Returns

void

Parameters

(array) $params Array of initalization parameters  (optional)

$this->fuel->redirects->add('$uri', ['$redirect'=''], ['$passive'=TRUE])

Adds to the redirects list.

Returns

array

Parameters

(string) $uri The URI location of the page to remove
(string) $redirect The page to redirect to or the type of redirect if the first parameter is an array (optional)
(boolean) $passive Determines whether it is a passive redirect or not. Default is TRUE(optional)

$this->fuel->redirects->remove('$uri', ['$passive'=TRUE])

Remove from the redirects list.

Returns

array

Parameters

(string) $uri The URI location of the page to remove
(boolean) $passive Determines whether it is a passive redirect or not. Default is TRUE(optional)

$this->fuel->redirects->add_ssl('$uri', ['$environment'=''])

Adds to the ssl redirect list.

Returns

array

Parameters

(string) $uri The URI location of the page to remove
(string) $environment The page to redirect to or the name of the environment if the first parameter is an array(optional)

$this->fuel->redirects->remove_ssl('$uri', ['$environment'='production'])

Remove from the ssl redirect list.

Returns

array

Parameters

(string) $uri The URI location of the page to remove
(string) $environment The name of the environment key that the redirect applies to (optional)

$this->fuel->redirects->add_non_ssl('$uri', ['$environment'=''])

Adds to the NON ssl redirect list.

Returns

array

Parameters

(string) $uri The URI location of the page to remove
(string) $environment The page to redirect to or the name of the environment if the first parameter is an array(optional)

$this->fuel->redirects->remove_non_ssl('$uri', ['$environment'='production'])

Remove from the NON ssl redirect list.

Returns

array

Parameters

(string) $uri The URI location of the page to remove
(string) $environment The name of the environment key that the redirect applies to (optional)

$this->fuel->redirects->config()

Returns the $config array.

Returns

array

$this->fuel->redirects->redirects(['$only_passive'=TRUE])

Returns the list of redirects.

Returns

array

Parameters

(boolean) $only_passive Determines whether only redirect those pages that are deemed "passive"

$this->fuel->redirects->execute(['$show_404'=TRUE], ['$only_passive'=TRUE])

Loops through the redirects config to find a possible match to redirect a page to.

Returns

void

Parameters

(boolean) $show_404 Determines whether to show a 404 page if the page doesn't exist
(boolean) $only_passive Determines whether only redirect those pages that are deemed "passive"

$this->fuel->redirects->ssl()

Loops through the ssl config to find a possible match to redirect to an SSL uri.

Returns

void

$this->fuel->redirects->non_ssl()

Loops through the ssl config to find a possible match to redirect to an NON SSL uri.

Returns

void

$this->fuel->redirects->enforce_host()

Will redirect the site based on the host (e.g. mysite.com vs www.mysite.com).

Returns

void

$this->fuel->redirects->test([$urls=array()])

Tests redirects and returns an array of valid URL and errors.

Returns

array

Parameters

(mixed) $urls an array or string of URLs to test. If none are provided, it will pull from the config