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?


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 =;

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:

I discovered that in my haste, I had copied the example above and replaced “” 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:


Is saved on your desktop as this:


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. Emory's love for social media and success with organic search led him to start a SEO consulting venture. Apart from the Internet, he could be considered by many as pretty worthless. More...


  1. 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

    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:

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

  3. Eshark

    Good tips! Thanks for sharing.

  4. alliancetelecom

    how is google adsense helpful to my website?

  5. Emory Rowland

    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.

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

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

    adsense code should look like this:


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


    Put this on .htaccess :

    RewriteRule ^pagead/expansion_embed.js$ [R=301,L]
    RewriteRule ^pagead/render_ads.js$ [R=301,L]
    RewriteRule ^pagead/test_domain.js$ [R=301,L]
    RewriteRule ^pagead/(.+)$$1 [R=301,L

  8. TD

    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. Why would it matter whether you saved it as .htm or .html? They are both the same thing basically.

  10. Emory Rowland

    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