How do I Fix Page not Found Errors in my Google AdSense Ads?

Anonymous Webmaster asks

Several of the Google AdSense ads on our site are showing a “page not found” error within the ad space. I have checked from multiple locations and still see the errors. Our ads are not showing in all cases. Can you advise as to how I can correct?

adsense-page-not-found.gif

This error had been puzzling me until recently when I saw the problem on one of my own sites and had to do some debugging. The answer starts with Google AdSense Alternative Ads, which provides a way to display your own ads if Google cannot display an ad on your page:

Alternate ads allow you to utilize your ad space in the event that Google is unable to serve targeted ads to your page. By default, Google shows public service ads (PSAs) if no targeted ads are available.

To display an altnernate ad, users are instructed to specify a URL pointing to their alternate ad resource, which looks this way inside the AdSense code:

google_alternate_ad_url = http://www.example.com/docs/alternatead.html;

A further advanced feature allows webmasters to collapse their ad if there are no targeted ads available so that it takes up no page space. This URL is given as an example:

http://www.example.com/scripts/google_adsense_script.html

I discovered that in my haste, I had copied the example above and replaced “example.com” with my own site name. That should work, right? Nooo… because I left the directory “/scripts/” in the path  which made it point to a dead file instead of “google_adsense_script.html,” which lay in my root directory.

To answer the original question, if you are seeing the ”page not found error” inside your AdSense units, it is likely caused by an invalid alternative ads path. Make sure your alternate ads URL path is pointing to the correct file location.

Remember that the page not found error only appears when Google cannot display an ad. It is difficult to test your fix because most of the time Google displays ads. If it displays an ad, it’s not looking for the alternative ad path and therefore not showing the error. ¿Comprende? 

Update: I have just discovered another way that the path gets messed up. When downloading the Google AdSense collapsing ad units script, Internet Explorer 7 truncates the file name by removing the “l” from the “.html” so this file:

google_adsense_script.html

Is saved on your desktop as this:

google_adsense_script.htm

Guess which browser I am using :)

Emory Rowland

Emory Rowland is editor and keeper of the flame at Clickfire. He's a fanatical blogger, entrepreneur and builder of Internet things from way back. He's a founder of several blogs including Testimony Share, a site that encourages Christians from all over the world to write and share their testimonies (see his). Emory's love for social media and success with organic search lead him to start Leverable, a SEO consulting venture. Later, he joined a leading Atlanta search marketing agency where he currently develops SEO strategies for top online brands. Apart from the Internet, he could be considered by many as pretty worthless. More...

10 comments

  1. Gecko September 20, 2007

    What do you think the best WordPress themes are for making money with Adsense. I’ve had some good themes before that didn’t perform well with Adsense.

  2. Emory Rowland September 21, 2007

    I’m not sure I can say there is a theme that I like better for adsense. Usually, I just wack the code at the beginning or end of the post or in the header or right column. I do see this widget based AdSense plugin that might work:

    http://wordpress.org/extend/plugins/adsense-manager/

    If you try it, let me know how it works please.

  3. Eshark September 29, 2007

    Good tips! Thanks for sharing.

  4. alliancetelecom October 10, 2007

    how is google adsense helpful to my website?

  5. Emory Rowland October 24, 2007

    Here’s a good concise snippet from the AdSense main page:

    AdSense for content automatically crawls the content of your pages and delivers ads (you can choose both text or image ads) that are relevant to your audience and your site content—ads so well-matched, in fact, that your readers will actually find them useful.

    http://www.google.com/adsense/

  6. ???? ???? March 15, 2009

    It also does not show on my site any other options ?

  7. opaliz May 31, 2009

    How do I Fix Page not Found Errors in my Google AdSense Ads?

    adsense code should look like this:

    window.google_render_ad();

    In some browsers, the code do not render correctly and look like this:

    window.google_render_ad();

    SOLUTION:
    Put this on .htaccess :

    RewriteRule ^pagead/expansion_embed.js$ http://pagead2.googlesyndication.com/pagead/expansion_embed.js [R=301,L]
    RewriteRule ^pagead/render_ads.js$ http://pagead2.googlesyndication.com/pagead/render_ads.js [R=301,L]
    RewriteRule ^pagead/test_domain.js$
    http://googleads.g.doubleclick.net/pagead/test_domain.js [R=301,L]
    RewriteRule ^pagead/(.+)$ http://googleads.g.doubleclick.net/pagead/$1 [R=301,L

  8. TD November 19, 2009

    One more reason for the error is if we do not put the script in well format. For example writing the script in one line will show page not found error. All the line breaks should be proper (as given by google) any change in the script (even formatting) will lead to “Page cannot be displayed error”

  9. H.L. October 11, 2011

    Why would it matter whether you saved it as .htm or .html? They are both the same thing basically.

  10. Emory Rowland October 11, 2011

    It gives a 404 error because the filename is “google_adsense_script.” If the filename were “index” and the user requested the root “/” in the browser, it wouldn’t matter, as you say.

Leave a comment