title: Wordpress: Custom search result page throws 404
body: <p>I have followed the link <a href="https://codex.wordpress.org/Creating_a_Search_Page" rel="nofollow noreferrer">here</a> in codex and created the following</p>
  <p>This is my searchform.php</p>
  <pre><code>&lt;form action=&quot;/search&quot; method=&quot;get&quot; role=&quot;search&quot; id=&quot;searchform&quot;&gt;
      &lt;div class=&quot;input-group&quot;&gt;
          &lt;input type=&quot;text&quot; name=&quot;s&quot; id=&quot;search&quot; class=&quot;form-control search-bar&quot; placeholder=&quot;Search Healthkart Blog&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot;&gt;
          &lt;div class=&quot;input-group-append button-icon&quot;&gt;
              &lt;button class=&quot;btn&quot; type=&quot;button&quot; id=&quot;searchBtn&quot;&gt;
                  &lt;img src=&quot;&lt;?php echo get_stylesheet_directory_uri(); ?&gt;/assets/images/search-icon.png&quot; alt=&quot;search&quot; class=&quot;search-icon-white&quot;&gt;
                  &lt;img src=&quot;&lt;?php echo get_stylesheet_directory_uri(); ?&gt;/assets/images/search-icon-grey.png&quot; alt=&quot;search&quot; class=&quot;search-icon-grey&quot;&gt;
              &lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>I have included it in header.php as</p>
  <pre><code>get_search_form(); 
  </code></pre>
  <p>And the JS for submitting the form in this way</p>
  <pre><code>$(&quot;#searchBtn&quot;).click(function(){
      $(&quot;#searchform&quot;).submit();
  })
  </code></pre>
  <p>I have also created a custom search result page called search.php and it contains the normal search page code. Then I have created a page in wordpress pages called search (URL as /search) and assigned the custom search result template to it.</p>
  <p>The issue is when I submit the form, it gets redirected to /search/?s=test123 and returns a 404 page. But if I hit the urls /search/test123, it works.</p>
  <p>How do I make the search form submit to the URL /search/test123 ?</p>