I'm setting up landing pages in Craft where someone can fill out a very basic form and get an eBook. My idea was to have the form /info/landing-page-title submit to /info/landing-page-title/thank-you, where they will be given a link to download their document. My plan was to use an if-then or switch statement in the template to check if segment(3) was populated or not. However, I'm having a difficult time getting it to redirect to the "thank-you" for the same landing page.

Currently I'm trying to use something like

/{{ craft.request.getSegment(1) }}/{{ craft.request.getSegment(2) }}/thank-you

While that will output fine on the page, the form is ignoring it.

Any suggestions on why, or a better way to do it?

1 Answer 1


I am not a big fan of using segments for form submission pages. It's an oldschool EE habit and these are pages you don't want listed anyway so query away. Maybe just have your form success page set to ?m=thankyou so it appends to the current url and retains the previous segments.

In your form:

<input type="hidden" name="redirect" value="?m=thankyou">

Your submission url's should look like:


Then in your template:

{% if craft.request.getParam('m') == 'thankyou' %}
  do stuff, make sure this page is nofollow, check other segments etc.
{% endif %}
  • Thank you - that worked great (and yes, I'm from EE). I was going to try to use a single form for all landing pages, but in reality it makes sense to have separate forms for tracking (plus I don't think they are going to change it that often). I appreciate your help - this will work great!!
    – Todd
    Apr 30, 2017 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.