Google ads + .htaccess + CI routing = 400 Bad Request |
[eluser]gautaml[/eluser]
I have a site that is very close to going live but I am having trouble embedding Googleads in the page. The ad doesn't show up and Chrome debug shows this: Image: Google Chrome debug I put the ad script on a page on its own (not CI tied) and it shows up fine so I don't suspect it's the .htaccess but something with routing. I have gone through several forum posts mostly those involving changing the config's uri_protocol (PATHINFO, etc) and enable_query_strings. Treid all sorts of combos but nothing works. Code: $config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/'; Here's my .htaccess Code: Header unset ETag And here's (some of) my routes.php Code: $route['default_controller'] = 'somepage'; Any help?
[eluser]John_Betong_002[/eluser]
If your page loads OK without Google Ads then this is the code that I use: Code: // ./application/view/_google_250x250.php
[eluser]gautaml[/eluser]
Well this is just interesting. I was wondering if it could be badly formatted HTML since in my page rendernig process I process the page as this to strip out all tabs line breaks and comments: Code: preg_replace('/<!--(.*)-->/Uis', '', preg_replace('/\t+|\r\n|\n|\r/', '', $output)); Here's the original code: Code: <div id="adbar"> If I remove all the HTML/JS comments the ads now come up. Guess it was fine all along but just something I did. whoops. ![]() BTW thanks John, what you posted made me think twice about what I was doing ![]()
[eluser]John_Betong_002[/eluser]
Here is how I compress the final output: Code: //============================================== edit: view source on this page: http://johns-jokes.com/2012-World-Cannot...cause.html |
Welcome Guest, Not a member yet? Register Sign In |