<p>Templates starting with an underscore character is by default denied direct access in Craft (resulting in a 404 not found error). I guess that renaming your template to "results" should fix it.</p>

CC BY-SA 3.0
2014-09-22T12:06:59.443Z
that was it! Thanks. Strange enough, my 404 template is not showing up at all...
jjem
CC BY-SA 3.0
2014-09-22T12:42:30.923Z
Check that you don't have any rewrite rules in your .htaccess concerning 404 handling. If there is a redirect in there, the request doesn't reach Craft at all.
André Elvan
CC BY-SA 3.0
2014-09-22T12:02:19.793Z
2014-09-22T12:02:19.793Z
André Elvan
<p>I am trying to set up a search form in my website. Followed <a href="http://buildwithcraft.com/docs/templating/search-form" rel="nofollow">this tutorial</a> on builtwithcraft documentation website.</p>

<p>So in my top navigation bar I include this code</p>

<pre><code>&lt;form class="navbar-form navbar-right" role="search" action="{{ url('/oeuvres/_results') }}"&gt;
    &lt;div class="input-group"&gt;
        &lt;input type="search" class="form-control" name="q" placeholder="Recherche"&gt;
        &lt;span class="input-group-btn"&gt;
            &lt;button type="button" class="btn btn-default" value="Go"&gt;&lt;span class="glyphicon glyphicon-search"&gt; &lt;/span&gt;&lt;/button&gt;
        &lt;/span&gt;
    &lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>And then the result page:</p>

<pre><code>{% extends "_layout" %}

{% block main %}
    {% include "includes/_topNav" %}

    &lt;div class="container"&gt;
        &lt;div class="row"&gt;
            &lt;div class="col-md-12"&gt;
                &lt;h1&gt;Résultats&lt;/h1&gt;

                {% set query = craft.request.getParam('q') %}
                {% set entries = craft.entries.search(query).section('oeuvres') %}

                {% if entries|length %}
                    &lt;p&gt;{{ entries|length }} Votre recherche:&lt;/p&gt;
                    &lt;ul&gt;
                        {% for entry in entries %}
                            &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
                        {% endfor %}
                    &lt;/ul&gt;
                {% else %}
                    &lt;p&gt;Votre recherche “{{ query }}” n'a donné aucun résultat.&lt;/p&gt;
                {% endif %}
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    {% include "includes/_javaScript" %}
{% endblock %}
</code></pre>

<p>I have no idea what is wrong, it seems that the "q" param is passing through the result page (the address line is for example: <a href="http://www.example.com/oeuvres/_results?q=routes" rel="nofollow">http://www.example.com/oeuvres/_results?q=routes</a>
But the page is totally blank. Meaning nothing gets generated between the body tags. (not even the template tags...</p>

<p>I can't find what I am missing here.</p>

<search>
Search form generates blank page
# Search form generates blank page

(Asked by: username_0 on 2014-09-22)

I am trying to set up a search form in my website. Followed this tutorial on builtwithcraft documentation website.
So in my top navigation bar I include this code

    
        
        
             
        
    


And then the result page:
{% extends "_layout" %}

{% block main %}
    {% include "includes/_topNav" %}

    
        
            
                Résultats

                {% set query = craft.request.getParam('q') %}
                {% set entries = craft.entries.search(query).section('oeuvres') %}

                {% if entries|length %}
                    {{ entries|length }} Votre recherche:
                    
                        {% for entry in entries %}
                            {{ entry.title }}
                        {% endfor %}
                    
                {% else %}
                    Votre recherche “{{ query }}” n'a donné aucun résultat.
                {% endif %}
            
        
    

    {% include "includes/_javaScript" %}
{% endblock %}

I have no idea what is wrong, it seems that the "q" param is passing through the result page (the address line is for example: http://www.example.com/oeuvres/_results?q=routes
But the page is totally blank. Meaning nothing gets generated between the body tags. (not even the template tags...
I can't find what I am missing here.

**Tags:** search


---

## 1 answers

### Answer by username_1 on 2014-09-22. Score: 1 | Accepted answer

Templates starting with an underscore character is by default denied direct access in Craft (resulting in a 404 not found error). I guess that renaming your template to "results" should fix it.

> **Comments:**
> **username_0**: that was it! Thanks. Strange enough, my 404 template is not showing up at all...  
> **username_1**: Check that you don't have any rewrite rules in your .htaccess concerning 404 handling. If there is a redirect in there, the request doesn't reach Craft at all.  

---

