Fix Google Adsense Search and Drupal Conflict
Google Adsense internal search code does not work with Drupal sites normally. The reason is $_GET[q] conflict between both services. $_GET[q] means "current page" for Drupal and "search query" for Google. We can fix it with two easy steps.
Step 1:
Create a custom page like "websearch" etc under Drupal and add Adsense Code for results page.
Step 2:
Add this code at the top of your Drupal's index.php:
// Fix Drupal-Adsense conflict $_GET[q] = ($_GET['cx']) ? "websearch" : $_GET[q] ;
Similar entries
- Best CMS and Web 2.0 Software in PHP-MySQL
- Bing vs. Google: a small comparison
- How to filter all html tags from each _GET and _POST request
- How do I secure my web site?
- Best websites for cool free fonts to download
- Drupal 6 vs. Joomla 1.5 (2009)
- WebSearch
- Why tableless design, DIV vs. TABLE
- Drupal and LDAP
- Url manipulation with mod_rewrite and php-catcher for beginners
- We need an Adsense alternative
- Most important sites for a webmaster
- Why Google-PR gives Drupal 8, Joomla 9 and Phpnuke 5?
- How to make website popular
- How to configure Google Adsense for Domains with Webmin ?
- Check password strength / safety with PHP and Regex
- Ajax Error when using Drupal with Firefox
- Register Globals Emulator for PHP
- List of Domains with Google PageRank 10
- Drupal fieldset default expanded not collapsed

Comments
Added to DrupalSightings.com
Added to DrupalSightings.com
Awesome!
Thanks, it worked! That was a quick fix compared to all of the longer methods I have seen previously.
Good
All ingenious is simple.
Google's solution
You can try to use
parameter for search results. And don't forget to change this input name in search form, ofcourse.
Enjoy.
How do I create a custom webpage in Drupal 5
Have been trying to do this since I've seen the solution, with no success...... :-(
adsense is not showing
Does this fix works for adsense 7.x dev? which was enabled last march of this year?
Post new comment