Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-09T12:49:59.117Z
Answers.LastActivityDate: 2019-04-09T13:00:19.883Z
Answers.LastEditDate: 2019-04-09T13:00:19.883Z
Answers.UserDisplayName: PhilipBoomy
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-09T12:57:34.587Z
Comments.Text: 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
Comments.UserDisplayName: Robin Schambach
Tags: <templating>
Title: Form Redirecting to Homepage
ThreadText: # 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?
  
  ```
  <form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
    {{ csrfInput() }}
    <input type="hidden" name="action" value="users/save-user">
    <input type="hidden" name="redirect" value="{{ craft.request.url }}">
    <input type="hidden" name="userId" value="{{ currentUser.id }}">
    <textarea id="summernote" name="fields[userAbout]">{{ currentUser.userAbout }}</textarea>
    <button class="btn btn-primary btn-md semi-bold mt-4" type="submit">Save Profile</button>
  </form>
  
  ```
  
  **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:
  
  ```twig
  <input type="hidden" name="redirect" value="{{ craft.app.request.absoluteUrl|hash }}">
  
  ```
  
  
  ---
  
  