• Resolved CallUp

    (@callup)


    I’ve been working on integrating this Google Custom Search into my site on and off over the last couple days, and I think I’ve finally figured it out.

    I’m hoping someone will have a good idea for the best possible solution.

    When the search results are generated from the Google search box located at the top of my home page the results are displayed accurately on my page (named ‘search’):
    http://localhost/search

    When the search results are generated from the Google search box located at the top of my category pages (i.e. category) the 404 Error is generated on:
    http://localhost/category/politics/search

    My ‘search’ page, to display the search results — which I created from my dashboard — can only be found at http://localhost/search.

    That’s why I’m getting the 404 error. It’s looking for my ‘search’ page at: localhost/category/politics/search, and it’s not there.

    So, the problem was that when Google asked me to name the page for search results, it said not to include the url — that a single page name like “search” would be appended at the end of the url automatically.

    I can hardcode the entire static url on my search form: <form action=”http://www.website.com/search&#8221; … instead of <form action=”search” … but I’d like to find a dynamically generated url that can work on both my local environment testing site and my main site.

    What would you advise?

    I understand there’s document.location.host in javascript. Perhaps something like <form action=document.location.host + “/search” ??????

    Any ideas on the very best way to achieve this so that it will work well on all browsers?

    I hope that someone will please answer me, this time.

Viewing 1 replies (of 1 total)
  • Thread Starter CallUp

    (@callup)

    This php option seems to work, so I guess I’ll stick with it:

    <form action=”<?php bloginfo(‘url’); ?>/search” id=”cse-search-box”>

Viewing 1 replies (of 1 total)
  • The topic ‘Google Custom Search — Close to fixing it’ is closed to new replies.