Skip to content

Issues with redirects - had to use exit to make it work and blank page  #1501

Closed
@daljit3

Description

@daljit3

name: Bug report
about: Help us improve the framework by reporting bugs!


Describe the bug
There are two issues with the redirect() method.

  1. I am not able to use return redirect()->to('/'); so I have to follow it up with an exit to make it work. e.g.
public function hello() {
//this won't work;
return redirect()->to('/');
//this works
redirect()->to('/');
exit;
}
  1. The other issue is none of the redirects are working now since approximately after yesterday (17 nov 2018) evening. To make sure, I haven't accidently broken it, I just downloaded a new copy of CI4-develop and after setup I could see welcome message to confirm everything working fine. Then I made these modifications below to the Home controller. If I try mylocalsite/home/daljit it just shows a blank page.
 namespace App\Controllers;

use CodeIgniter\Controller;

class Home extends Controller
{
	public function index()
	{
		return view('welcome_message');
	}

	//--------------------------------------------------------------------
    public function daljit()
    {
        return redirect()->to("/home/hello");
    }

    public function hello()
    {
        echo "Hello!";
    }
}

CodeIgniter 4 version
CodeIgniter 4 develop branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions