Answers.Body: <p><a href="http://buildwithcraft.com/docs/templating/redirect" rel="nofollow">Redirecting</a> to the first result is simple...</p>
  
  <pre><code>{% if results|length == 1 %}
      {% redirect results[0].url %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-27T19:18:21.600Z
Answers.LastActivityDate: 2015-10-27T19:18:21.600Z
Answers.UserDisplayName: Lindsey D
Body: <p>When performing a search on the front-end, is it possible to have two different behaviors, depending on the number of results?</p>
  
  <ul>
  <li>With more than one result, show the normal "results" page.</li>
  <li>With only a single result, <strong>automatically redirect to that entry page.</strong></li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-27T19:07:19.853Z
Comments.Text: I've reworded the question based on what I believe you are after... Please feel free to roll it back (or edit further) if I am mistaken!
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-27T19:27:59.353Z
Comments.Text: Ahhh... thanks for the edit / translation @Lindsey.
Comments.UserDisplayName: carlcs
Tags: <search>
Title: Front-end searching: Automatically redirect when only 1 result
ThreadText: # Front-end searching: Automatically redirect when only 1 result
  
  (Asked by: username_0 on 2015-10-27)
  
  When performing a search on the front-end, is it possible to have two different behaviors, depending on the number of results?
  
  * With more than one result, show the normal "results" page.
  * With only a single result, **automatically redirect to that entry page.**
  
  **Tags:** search
  
  > **Comments:**
  > **username_1**: I've reworded the question based on what I believe you are after... Please feel free to roll it back (or edit further) if I am mistaken!  
  > **username_2**: Ahhh... thanks for the edit / translation @username_1.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-27. Score: 2 | Accepted answer
  
  [Redirecting](http://buildwithcraft.com/docs/templating/redirect) to the first result is simple...
  
  ```
  {% if results|length == 1 %}
      {% redirect results[0].url %}
  {% endif %}
  
  ```
  
  
  ---
  
  