<p>Forgot to add the return keyword :(</p>
<p><code>return $this-&gt;redirect('https://foobar.test');</code></p>

CC BY-SA 4.0
2020-06-22T09:16:00.127Z
2020-06-22T09:16:00.127Z
Rohan
<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>

<craft3><php><controller>
Controller redirect not working in craft 3
# 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');`


---

