ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search Form Redirecting to Home Page On Submit

November 07, 2012 5:12pm

Subscribe [1]
  • #1 / Nov 07, 2012 5:12pm

    Lance Britton

    9 posts

    Here is the code that we have for the Search form:

    {exp:search:simple_form channel="blog|work|pages" search_in="everywhere" no_result_page="search/oops" result_page="search/index"}
         <input type="text" name="keywords" title="Search…">
         <button type="submit">/files/images/go.png</button>
        {/exp:search:simple_form}

    And here is the code that we have for our Search page template (search/index):

    {embed=default/.head title="Search Results"}
        <div id="inside">
         <div class="content">
         <h1>Search Results</h1>{exp:search:search_results}
          <div class="result">
           <h3><a href="http://{if">{title}</a></h3>
    <p>       {exp:word_limit total="30"}{excerpt}{/exp:word_limit}<br />
          </div>{/exp:search:search_results}<br />
        </div><br />
        <div id="sidebar">{exp:channel:entries entry_id="11"}<br />
         {sidebar_content}{/exp:channel:entries}<br />
        </div><br />
    {embed=default/.footer}

    The search function should work, because we have another site (Site #2) that uses near identical code and it works. Looking at the database that Site #1 is linked to, we are also getting up to date logs on all searches attempted using the form.

    When the form is submitted, however, the page redirects to the homepage.

    You can test this for yourself here: http://www.acsadvertisinginc.com/

    (And the sister site, the working one, is here: http://www.trippak.com/ )

    Thanks

  • #2 / Nov 08, 2012 11:48am

    Lance Britton

    9 posts

    Never mind.

    I was able to fix this by adding the “www.” back to the site URL in the Admin > General Configuration page.

    It was removed for some purpose regarding SEO by another colleague.

  • #3 / Nov 08, 2012 12:51pm

    Dan Decker

    7338 posts

    Hi Lance,

    Indeed, ExpressionEngine doesn’t care if “www” is included or not, but it does need to be consistent one way or the other. So, if you choose to have it or not, make sure you are enforcing it throughout URL values in your Control Panel and perhaps even a directive in .htaccess

    If you need anything else, please let me know!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases