<p>I believe its because you are not "hashing" the URL. Either use this <a href="https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url" rel="nofollow noreferrer">https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url</a> or as that the link also mentions: </p>

<pre class="lang-twig prettyprint-override"><code>&lt;input type="hidden" name="redirect" value="{{ craft.app.request.absoluteUrl|hash }}"&gt;
</code></pre>

CC BY-SA 4.0
2019-04-09T12:49:59.117Z
2019-04-09T13:00:19.883Z
2019-04-09T13:00:19.883Z
PhilipBoomy
<p>I'm trying to make a form redirect to the current page, but it's currently redirecting itself to the homepage every time the form submits? I can't see anything wrong with the code itself?</p>

<pre><code>&lt;form method="post" accept-charset="UTF-8" enctype="multipart/form-data"&gt;
  {{ csrfInput() }}
  &lt;input type="hidden" name="action" value="users/save-user"&gt;
  &lt;input type="hidden" name="redirect" value="{{ craft.request.url }}"&gt;
  &lt;input type="hidden" name="userId" value="{{ currentUser.id }}"&gt;
  &lt;textarea id="summernote" name="fields[userAbout]"&gt;{{ currentUser.userAbout }}&lt;/textarea&gt;
  &lt;button class="btn btn-primary btn-md semi-bold mt-4" type="submit"&gt;Save Profile&lt;/button&gt;
&lt;/form&gt;
</code></pre>

CC BY-SA 4.0
2019-04-09T12:57:34.587Z
Little hint: if you remove the `redirect` at all it should always remain on the same page and doesn't redirect to another one unless you have certain events
Robin Schambach
<templating>
Form Redirecting to Homepage
# Form Redirecting to Homepage

(Asked by: username_0 on 2019-04-09)

I'm trying to make a form redirect to the current page, but it's currently redirecting itself to the homepage every time the form submits? I can't see anything wrong with the code itself?

  {{ csrfInput() }}
  
  
  
  {{ currentUser.userAbout }}
  Save Profile

**Tags:** templating
> **Comments:**
> **username_1**: Little hint: if you remove the `redirect` at all it should always remain on the same page and doesn't redirect to another one unless you have certain events  

---

## 1 answers

### Answer by username_2 on 2019-04-09. Score: 3 | Accepted answer

I believe its because you are not "hashing" the URL. Either use this https://docs.craftcms.com/v3/dev/functions.html#redirectinput-url or as that the link also mentions:


---

