How to do 301 redirects in CodeIgniter?

Member

kade.hermiston

by kade.hermiston , in category: Technology , a month ago

How to do 301 redirects in CodeIgniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by cristobal , a month ago

We can use redirect helper to do 301 redirects in Codeigniter.

Syntax :

1
 redirect($uri = '', $method = 'auto', $code = NULL)

Parameter:

1
2
3
    $uri (string)  URI string
    $method (string)  Redirect method (‘auto’, ‘location’ or ‘refresh’)
    $code (string)  HTTP Response code (usually 302 or 303)

Return type: void

Sample Usage:-

1
redirect('/posts/13', 'New location', 301);