Title: Search function awry
Last modified: August 20, 2016

---

# Search function awry

 *  [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/)
 * Hey Folks,
 * I went ahead and tweaked my blog according to [this page](http://codex.wordpress.org/Creating_a_Static_Front_Page):
   w/p is located in the folder ‘journal’, but the pages are in the root folder 
   so their url is like this:
 *  [http://www.skolaiimages.com/wp-page/](http://www.skolaiimages.com/wp-page/)
   
   but the blog posts use the permalink /journal/date/post/
 * [http://www.skolaiimages.com/journal/date/post.html](http://www.skolaiimages.com/journal/date/post.html)
 * Everything seems to work just fine:
 * [http://www.skolaiimages.com/journal/](http://www.skolaiimages.com/journal/)
 * except the search feature now just takes me to the home page, not any actual 
   search results. Is there something I’ve done incorrectly? I can’t seem to correct
   this.
 * Thanks so much in advance.
 * Cheers
 * Carl

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/search-function-awry/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/search-function-awry/page/2/?output_format=md)

 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460414)
 * What code are you using for your search function?
 * I normally use something like this:
 *     ```
       <form action="<?php echo home_url(); ?>" id="searchform" method="get">
       	<label for="s" class="screen-reader-text">Search for:</label>
           <input type="text" id="s" name="s" value="" />
           <input type="submit" value="Search" id="searchsubmit" />
       </form>
       ```
   
 *  Thread Starter [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460625)
 * Hey Christine
 * Thanks for the note and help. Here’s what I have in my sidebar:
 *     ```
       <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
       <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
       <input type="submit" id="searchsubmit" value="Search this Journal" />
       </div>
       </form>
       ```
   
 * The problem appears to be some kind of override between my static home page (
   index.html) and the wordpress page I uploaded to make the pages work from the
   root directory (index.php) .. if I drop the index.html page, the search function
   works correctly. I guess because w/p finds the index.php page. but if I have 
   the index.html page up, then any search form my blog just takes the user to the
   home page, no search results.
 * Everything worked just fine until last week when I made some changes, so that
   I could build pages in w/p that en up in the root directory of the site, while
   the blog posts still are linked to the journal (i.e., wp) directory via the permalink.
 * What I need to be able to do is somehow have the search function actually find
   the index.php file, but I don’t know how w/out losing the static html file.
 * Thanks so much,
 * Cheers
 * Carl
 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460630)
 * I don’t think that you can have an index.html and index.php in the same directory.
   I think that you’ll need to put your entire WordPress in a separate folder. I
   would just put it in a folder called journal.
 *  Thread Starter [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460632)
 * hey Christine
 * Thanks. I have had the entire w/p section in the ‘journal’ folder up til last
   week. it works great for the blog posts. but I don’t want the static pages to
   be at skolaiimages.com/journal/page … but simply skolaiimages.com/page – so when
   I started building the static pages in w/p I made the changes above. And it works
   fine except for the search function. Maybe I need to move my index.html page 
   to ‘home.html or something, and then update all my navigation. That way I can
   have a static page, and the index.php simply be for functionality of the w/p 
   section. Almost all the site is either static html.
 * I know it’s possible to have w/p NOT be in the root directory,
    [http://codex.wordpress.org/Creating_a_Static_Front_Page](http://codex.wordpress.org/Creating_a_Static_Front_Page)
   but have it function as if it were, yet have a static landing page. I just don’t
   know how to incorporate the search function to work correctly.
 * Thanks so much,
 * Cheers
 * Carl
 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460633)
 * Sorry, I thought that your index.html was a separate html page. Is your home 
   page, a page in WordPress? If so then it’s index.php and there is no index.html.
   If your site is entirely made of wordPress pages and posts, then there are NO
   index.html pages anywhere, it’s all php.
 * Yes you can have a static page not be your blog. That’s how my site is set up..
   so perhaps your search function is simply just not right. Have you tried the 
   code I use?
 *  Thread Starter [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460636)
 * hey Christine
 * It’s hard to explain, I have a few threads on this topic, and they’re all related.
 * No, my home page is a static page I’ve had for years, index.html
 * however, in order to run w/p off the root directory, like I am trying, I had 
   to upload index.php to the root directory as well. That means I have both files,.
   html and .php, in the root directory.
 * yes, I tried your search form; it’s the same thing. The problem is not the search
   function, as it was working just fine.
 * The problem is trying to run w/p from the root directory, w/ a separate static
   html page as the home page of the website, and having that page be index.html..
   as I said above, if I remove the index.html page from my root directory, everything
   works just fine …. I don’t want to change it to home.html, or even index.php,
   if I can help it, it would mean a lot of navigation updating and losing a lot
   of history on the search engines for my home page.
 * up until last week, only the blog posts were run from w/p everything else is 
   either static pages or the albums are driven by coppermine gallery. I decided
   to add some new w/p pages as well.
 * Thanks for your continued patience and help.
 * Cheers
 * Carl
 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460637)
 * Do you have a search template in your theme? Perhaps having one of those would
   help, but I’m not even sure. I don’t think that having an index.html and index.
   php in the root is possible and changing index.html, I don’t think will help 
   either.
 * I’m running out of ideas, sorry….
 *  Thread Starter [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460638)
 * hello Christine
 * Yes, the search function works perfectly when I don’t have the index.html file
   in the root folder. As soon as I rename that file to say index-bak.html, it all
   works fine .. except of course, all my links to my home page (i.e., index.html)
   are dead.
 * The problem is having a static page called index.html in the root directory.
 * What is your static home page called? Is it the index.php file?
 * Yes, my theme has a search function, and it works fine until i tried to run wordpress
   from the root directory.
 * In the code, whether I use yours or mine,
 *     ```
       <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
       <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
       <input type="submit" id="searchsubmit" value="Search this Journal" />
       </div>
       </form>
       ```
   
 * doesn’t `<?php bloginfo('home'); ?>` point to the home page? Which, w/ my w/p
   setup, is pointing to the root directory and has no file name .. if I can point
   it to the index.php file inside the w/p directory (journal) then I think it would
   work. But I don’t know how to do that.
 * Thanks so much
 * Cheers
 * Carl
 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460654)
 * Hi Carl,
    The search function is different from the search template. WordPress
   themes use templates, index.php, archive.php, page. php….. etc ….
 * There’s one called search.php and it will display search results.
 * Here’s more info about templates – [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 * In the WordPress hierarchy, WordPress will look for search.php and if there is
   no file, it will then use index.php. So I’m guessing you don’t have one and that’s
   why it’s trying to use your index.php and it’s conflict with your index.html.
 * As I said earlier, mixing WordPress and html in the same directory is NOT a good
   idea. I do NOT have any html pages. All my pages are created using WordPress.
 *  Thread Starter [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460666)
 * Hey Christine
 * Thanks.
 * Yes, my theme has a search function; it’s worked perfectly for years. This search
   thing only went awry when I changed the directory structure to move how w/p functions,
   from the ‘journal’ folder, to the root directory.
 * And it still works, when I remove the index.html file from the root directory.
   Or, if I point, via Settings/reading the front page to the ‘journal’ directory.
   I don’t want to do that if I build Pages in w/p, because I don’t want their url
   to be skolaiimages.com/journal/Page .. it doesn’t make any sense to have them
   in a directory called ‘journal’ or ‘blog’ or anything if they’re regular pages,
   not Blog posts.
 * I’m curious now; you said earlier you “_Yes you can have a static page not be
   your blog. That’s how my site is set up.._” … how can you have a static page 
   if you do NOT have any html pages? All wordpress pages are dynamic.
 * I uploaded both the search.php and the searchform.php files to my root directory,
   but it still doesn’t work.
 * What’s frustrating is there’s gotta be some easy remedy to this, without undoing
   everything.
 * Thanks
 * Cheers
 * Carl
 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460669)
 * The search.php does not go in the root directory it goes in the theme directory..
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460671)
 * Static front page – [http://codex.wordpress.org/Creating_a_Static_Front_Page](http://codex.wordpress.org/Creating_a_Static_Front_Page)
 * Carl, please don’t sign your posts, by the way 🙂 We can see who you are by looking
   at your pretty gravatar and handle 🙂
 *  [Eric Mann](https://wordpress.org/support/users/ericmann/)
 * (@ericmann)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460672)
 * [@walkinman](https://wordpress.org/support/users/walkinman/) – Actually, nothing’s
   wrong.
 * When a web browser requests your site ([http://www.skolaiimages.com/](http://www.skolaiimages.com/)),
   your webserver tries to deliver a default page back to the browser. The problem
   you’re facing is that you have _two_ default pages – `index.php` and `index.html`.
 * The `.html` page is your old school static home page. The `.php` page is the 
   core initializer for WordPress.
 * In other words, when you remove or rename `index.html`, your webserver directs
   all traffic to [http://www.skolaiimages.com/](http://www.skolaiimages.com/) into
   WordPress and lets WP take care of it. When you restore your `index.html` page,
   the webserver ignores WordPress entirely and just returns the static file.
 * **Your search function**
 * Your search form is attempting to post to WordPress – Specifically, the `action
   ="<?php bloginfo('home'); ?>` line is trying to send the search request to [http://www.skolaiimages.com/](http://www.skolaiimages.com/).
   But when the `index.html` file is present in the root of your system, WordPress
   never sees the request.
 * _That_ is why the search doesn’t seem to be working.
 * **Fixing the problem**
 * The second issue you’re facing is a slight misunderstanding of what WordPress
   means by a “static front page.”
 * WordPress can deliver traffic to the root of your site – traffic to [http://www.skolaiimages.com/](http://www.skolaiimages.com/)–
   to a _page rendered by WordPress_. You _cannot_ use a static `.html` page for
   this. All traffic to the root of your site _must_ go through WordPress to work
   correctly.
 * So I recommend setting up a Page in WordPress (just like you would any other 
   post or page) and calling it something along the lines of “Home.” Then follow
   the steps outlined in the “Creating a Static Front Page” article you’ve already
   seen to set it as the homepage for your site. Then remove `index.html` from the
   root of your site.
 *  Thread Starter [walkinman](https://wordpress.org/support/users/walkinman/)
 * (@walkinman)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460675)
 * Hey Folks,
 * Christine – I’m aware of that. I put it in the root directory because you said
   perhaps “I don’t have one” which is clearly not the case. It has worked fine 
   for many years now. It only stopped working when I tried to make some changes
   with where w/p drives from, which the folks above have now talked about.
 * [@ipstenu](https://wordpress.org/support/users/ipstenu/) – are you serious? putting
   a name to my post is a problem? I sign it, because it seems a polite thing to
   do. The same way I say “thank you” when someone helps out. I’m amazed this is
   somehow a problem. No offense meant to anyone, but that’s just weird. I’m curious
   what’s the reasoning behind a request NOT to sign my name?
 * Also, if you read the thread, I posted that same link in the OP of this thread.
   That’s how I got in this mess. 🙂
 * [@eric](https://wordpress.org/support/users/eric/) Mann
 * Thank you – that’s definitely what’s going on, I was just hoping there would 
   be some workaround, without having to rename my html page or use the w/p as a
   landing page. I can change my current index.html to home.html, and repoint all
   my navigation to that page, and then the w/p index.php will serve as little more
   than a functionality tool to drive w/p; as well as a landing page when someone
   simply visits skolaiimages.com (as opposed, say, to skolaiimages.com/home.html).
   Is that correct?
 * I remember reading, somewhere, about the w/p use of “static front page” – they
   mean a virtual static page. Because I’m using a combination of .html files and
   the w/p platform, I call the .html files static pages, because they’re intrinsically
   different, and separate from, the w/p pages.
 * Anyway .. does anyone know if this (below) will cause any problems? Here’s what
   I did:
 * Under Settlings/General I just switched the site address (URL) to [http://www.skolaiimages.com/index.php](http://www.skolaiimages.com/index.php)
 * what I had was [http://www.skolaiimages.com/](http://www.skolaiimages.com/)
 * which drove everything to the default index.html page. Now, it seems to work 
   fine; when I search, the results are ok, and the url is [http://www.skolaiimages.com/index.php/?s=elk](http://www.skolaiimages.com/index.php/?s=elk)
 * which is weird, I know .. and all the links, like categories, etc, go to [http://www.skolaiimages.com/index.php/journal/category/alaska/](http://www.skolaiimages.com/index.php/journal/category/alaska/)
 * but then default to
 * [http://www.skolaiimages.com/journal/category/alaska/](http://www.skolaiimages.com/journal/category/alaska/)
 * which is correct. They all show up just fine, but I don’t know if this will cause
   any other array of problems as yet undiscovered.
 * so its seems to actually “work” – but probably should NOT work. 🙂
 * So maybe until I can fix the home page, or design the ‘virtual static page’ in
   w/p to match my current home page, and redo all my navigation (they all point
   to skolaiimages.com/index.html) this is kind of a workaround?
 * My other hesitation to change things too much is the page rank of an older home
   page (index.html) suddenly going away w/ a new page .. though I don’t know how
   much this will change things in reality.
 * Thanks again, I appreciate your patience.
 * Cheers
 * no-name 🙂
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/#post-2460680)
 * From the forum etiquette FAQ:
 * “Signatures in threads will be removed as they cause clutter and distract from
   the information and help provided”
 * [http://codex.wordpress.org/Forum_Welcome#Signatures](http://codex.wordpress.org/Forum_Welcome#Signatures)
 * Nothing sinister. 😉

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/search-function-awry/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/search-function-awry/page/2/?output_format=md)

The topic ‘Search function awry’ is closed to new replies.

## Tags

 * [splash-page](https://wordpress.org/support/topic-tag/splash-page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 5 participants
 * Last reply from: [walkinman](https://wordpress.org/support/users/walkinman/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/search-function-awry/page/2/#post-2460684)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
