Answers.Body: <p>If you're using the Pixel &amp; Tonic Contact Form plugin then there is a way to set your redirect using <code>{{ redirectInput('contact/thanks') }}</code> as seen here: <a href="https://github.com/craftcms/contact-form" rel="nofollow noreferrer">https://github.com/craftcms/contact-form</a></p>
  
  <p>However, I've just noticed you've tagged this question with <code>plugin-sproutseo</code>, but I'm not aware of that plugin interacting with contact forms in any way.</p>
  
  <p>To more specifically try to answer your question, firstly to redirect and pass some information, I have used query params before so I've set my redirect link to be <code>/thankyou?name={{ formstuff.name }}</code> so I can access the user's name with:</p>
  
  <pre><code>{% set name = craft.app.request.getParam('name') %}
  </code></pre>
  
  <p>Now when it comes to redirecting back to the user's previous page, have a read of this answer below. It's a few years old, but it'd potentially still give you an option to resolve your issue: <a href="https://craftcms.stackexchange.com/a/13488/5845">https://craftcms.stackexchange.com/a/13488/5845</a></p>
  
  <p>EDIT: After a look at some other questions, I've noticed this one has an almost identical wording so this one should be marked as duplicate. See dupe below:</p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/28433/how-to-redirect-the-page-with-params">How to redirect the page with params?</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-18T16:20:42.333Z
Answers.LastActivityDate: 2018-11-18T16:20:42.333Z
Answers.UserDisplayName: Jay
Body: <p>In the front-end, I create a form and submit the data to backend. In the controller, if got some errors, I would like to redirect to the previous page with some information<a href="https://craftcms.stackexchange.com">.</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-15T12:40:20.540Z
Comments.Text: Hello Dave. You've tagged this question with `sprout-seo` but your questions sounds like a more general form question. Sprout SEO can help you manage general redirects for pages that change URLs on your site, but redirecting on success or errors in forms should be handled within the form workflow itself. Can you update your question to be more specific about how you have built and are submitting your form? Is this a Craft Front End Form? Is the controller you mention a custom controller that you wrote? Any code examples about how you are currently trying to handle redirects?
Comments.UserDisplayName: Ben Parizek
Tags: <plugin-sproutseo>
Title: How to redirect the page
ThreadText: # How to redirect the page
  
  (Asked by: username_0 on 2018-11-15)
  
  In the front-end, I create a form and submit the data to backend. In the controller, if got some errors, I would like to redirect to the previous page with some information[.](https://craftcms.stackexchange.com)
  
  **Tags:** plugin-sproutseo
  
  > **Comments:**
  > **username_1**: Hello Dave. You've tagged this question with `sprout-seo` but your questions sounds like a more general form question. Sprout SEO can help you manage general redirects for pages that change URLs on your site, but redirecting on success or errors in forms should be handled within the form workflow itself. Can you update your question to be more specific about how you have built and are submitting your form? Is this a Craft Front End Form? Is the controller you mention a custom controller that you wrote? Any code examples about how you are currently trying to handle redirects?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-11-18. Score: 1
  
  If you're using the Pixel & Tonic Contact Form plugin then there is a way to set your redirect using `{{ redirectInput('contact/thanks') }}` as seen here: <https://github.com/craftcms/contact-form>
  
  However, I've just noticed you've tagged this question with `plugin-sproutseo`, but I'm not aware of that plugin interacting with contact forms in any way.
  
  To more specifically try to answer your question, firstly to redirect and pass some information, I have used query params before so I've set my redirect link to be `/thankyou?name={{ formstuff.name }}` so I can access the user's name with:
  
  ```
  {% set name = craft.app.request.getParam('name') %}
  
  ```
  
  Now when it comes to redirecting back to the user's previous page, have a read of this answer below. It's a few years old, but it'd potentially still give you an option to resolve your issue: <https://craftcms.stackexchange.com/a/13488/5845>
  
  EDIT: After a look at some other questions, I've noticed this one has an almost identical wording so this one should be marked as duplicate. See dupe below:
  
  [How to redirect the page with params?](https://craftcms.stackexchange.com/questions/28433/how-to-redirect-the-page-with-params)
  
  
  ---
  
  