Google Custom Search Engine (cse) page not found in Drupal when using iframe hosting option

I'm using Google's custom search engine in a Drupal site. I am using the iframe hosting option. I get a Page Not Found error. Try it here: Search for "Pregnancy Calendar".

If I take a couple variables of the resulting url out of the query string and leave only these trailing the url: ?cx=partner-pub-8269249097348173%253Ayqmzpr-2cr9&cof=FORID%253A10

I still don't get any results. Any Google CSE experts out there?



Are you using the Google CSE module, if not I strongly suggest it. By default Drupal and Google CSE both use the q GET variable which can causes problems. The module I linked to above takes care of that.

You can use the Google CSE module as jhuebsch mentioned, but the root of the problem is that Drupal depends on using the q GET parameter for determining what page to serve, while Google CSE uses it to determine what the search query is. So, what's occuring is the search query is being sent to Drupal, which obviously can't find the page you're requesting.

So, if you wanted to deal with it yourself, use Google CSE's as_q parameter, which was designed to deal with this problem. The Google CSE module incorporates this workaround.

The problem is that Drupal interprets the q= parameter as a page name. I use a .htacces rewrite to hide the parameter on the search page from PHP, and therefore, from Drupal. Google CSE runs client-side and will still see the parameter:

RewriteRule ^search$ index.php?q=search [L]

Adjust the search page name ("search") as neccessary and insert the line at the top of the file. That's it. No module required.

Need Your Help

OpenTK - How to rotate object by given angle

c# opengl rotation opentk trackball

I was using tutorial on to program trackball. I have axis and angle computed but because I am just beginner to OpenTK and OpenGL, I don't know how to apply rotat...

How to return a different object from the one you run a query on in OData? odata

I'm trying to return an object from the controller's Get method that is of a different class from the class the query is run on.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.