Answers.Body: <p>Forgot to add the return keyword :(</p>
  <p><code>return $this-&gt;redirect('https://foobar.test');</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-22T09:16:00.127Z
Answers.LastActivityDate: 2020-06-22T09:16:00.127Z
Answers.UserDisplayName: Rohan
Body: <p>I am working with Craft 3 and in my controller, I am trying to do this</p>
  <p><code>$this-&gt;redirect('https://foobar.test');</code></p>
  <p>But it is throwing me back to the root url of my craft site. I am confused, what else do I need to do?</p>
  
Tags: <craft3><php><controller>
Title: Controller redirect not working in craft 3
ThreadText: # Controller redirect not working in craft 3
  
  (Asked by: username_0 on 2020-06-18)
  
  I am working with Craft 3 and in my controller, I am trying to do this
  
  `$this->redirect('https://foobar.test');`
  
  But it is throwing me back to the root url of my craft site. I am confused, what else do I need to do?
  
  **Tags:** craft3, php, controller
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-06-22. Score: 2 | Accepted answer
  
  Forgot to add the return keyword :(
  
  `return $this->redirect('https://foobar.test');`
  
  
  ---
  
  