<p>The client must have added a new rule which was causing the problem.</p>

<p>changed from </p>

<pre><code>RewriteRule (.+) index.php?p=$1 [L]
</code></pre>

<p>to </p>

<pre><code>RewriteRule (.+) index.php [L]
</code></pre>

<p>Not exactly sure why they added that but...</p>

CC BY-SA 3.0
2016-10-12T18:54:25.937Z
I encountered a similar problem.  I've been using the letter "p" as part of a search string so `www.website.com/test?p=querystring`. It worked for more 6 months and now all of a sudden it doesn't work.  Thanks to this post I looked in my .htaccess file and see this rewrite rule: `RewriteRule (.+) index.php?p=$1 [QSA,L]` which was there by default when I installed Craft.  I changed my query string parameter to "q" and now it works again.  Not sure if something changed when I updated to the latest Craft version or if it's something else.
Lori
CC BY-SA 3.0
2015-07-01T20:30:12.643Z
2015-07-02T00:33:54.520Z
2015-07-02T00:33:54.520Z
Bowenac
<p>Not sure what is happening but </p>

<pre><code>{% set searchQuery = craft.request.getParam('q') %}
</code></pre>

<p>Does not seem to be working at all on a different server than staging. Anyone seen this before? Any ideas what could be preventing getParam from working? Here is what the end of my url looks like with the param: <code>results?q=test</code></p>

<p>I then later try to display the search parameter like.</p>

<pre><code>&lt;h1 class="text-uppercase"&gt;Search Results {{searchQuery}}&lt;/h1&gt;
</code></pre>

<p>But it only displays Search Results leaving the parameter empty... and my search results seem to be returning everything since it is basically doing a wildcard search since I'm using this below to query the matching results...</p>

<pre><code>{% paginate craft.entries.search(searchQuery).order('score').limit(10) as entries %}
</code></pre>

<p>Everything works as expected on staging server.</p>

CC BY-SA 3.0
2015-06-30T17:19:23.403Z
Are you sure `getParam` is the issue?  What happens if you `{{ searchQuery }}` immediately after `{% set searchQuery = craft.request.getParam('q') %}`?  Does it output `test`?
Brad Bell
CC BY-SA 3.0
2015-06-30T17:32:26.887Z
Outputs nothing, just like how its not outputting in the h1 I mentioned.
Bowenac
CC BY-SA 3.0
2015-06-30T17:44:59.407Z
Maybe some `.htaccess` rewrite rule that's dropping query strings?
Brad Bell
CC BY-SA 3.0
2015-07-01T03:26:23.497Z
It sure was, client added some odd rule.
Bowenac
CC BY-SA 3.0
2015-07-01T04:51:51.817Z
Can you add that as an official answer?
Brad Bell
<plugin-development><templating><params>
getParam not working on live server?
# getParam not working on live server?

(Asked by: username_0 on 2015-06-30)

Not sure what is happening but 
{% set searchQuery = craft.request.getParam('q') %}

Does not seem to be working at all on a different server than staging. Anyone seen this before? Any ideas what could be preventing getParam from working? Here is what the end of my url looks like with the param: results?q=test
I then later try to display the search parameter like.
Search Results {{searchQuery}}

But it only displays Search Results leaving the parameter empty... and my search results seem to be returning everything since it is basically doing a wildcard search since I'm using this below to query the matching results...
{% paginate craft.entries.search(searchQuery).order('score').limit(10) as entries %}

Everything works as expected on staging server.

**Tags:** plugin-development, templating, params

> **Comments:**
> **username_1**: Are you sure `getParam` is the issue?  What happens if you `{{ searchQuery }}` immediately after `{% set searchQuery = craft.request.getParam('q') %}`?  Does it output `test`?  
> **username_0**: Outputs nothing, just like how its not outputting in the h1 I mentioned.  
> **username_1**: Maybe some `.htaccess` rewrite rule that's dropping query strings?  
> **username_0**: It sure was, client added some odd rule.  
> **username_1**: Can you add that as an official answer?  

---

## 1 answers

### Answer by username_0 on 2015-07-01. Score: 3

The client must have added a new rule which was causing the problem.
changed from 
RewriteRule (.+) index.php?p=$1 [L]

to 
RewriteRule (.+) index.php [L]

Not exactly sure why they added that but...

> **Comments:**
> **username_2**: I encountered a similar problem.  I've been using the letter "p" as part of a search string so `www.website.com/test?p=querystring`. It worked for more 6 months and now all of a sudden it doesn't work.  Thanks to this post I looked in my .htaccess file and see this rewrite rule: `RewriteRule (.+) index.php?p=$1 [QSA,L]` which was there by default when I installed Craft.  I changed my query string parameter to "q" and now it works again.  Not sure if something changed when I updated to the latest Craft version or if it's something else.  

---

