0
$this->request->redirect('localhost/project2/');

From a controller in project1, I have this code, but it's always redirecting me to localhost/project1/index.php/localhost/project2. How can I properly redirect to localhost/project2/ ?

I tried using header() to redirect but its not working in Kohana. Im using Kohana 3.2 in PHP 5.5.12

Alex Coroza
  • 1,747
  • 3
  • 23
  • 39

1 Answers1

1

You should use http before link to specify it is a complete URL:

$this->request->redirect('http://localhost/project2/');

And you shouldn't use the localhost as a static text in your code because your server will changed, you should use on of the ways to return your server root like $_SERVER['HTTP_HOST'] or if you use a MVC framework you can use its function that return base URL.

Gouda Elalfy
  • 6,888
  • 1
  • 26
  • 38