Webpage not being indexed in Google?
Recently I was moving over an old test site’s content from a domain that I had leased and no longer wanted, to put the content on a new .info site.
So I purchased hosting, copied all the files and uploaded them on to the server, edited the web.config (it was .net) and it all appeared to work without too much trouble.
Next I added a new design and everything seemed to run smoothly
After that I verified the account in Google Webmaster Tools, sat back and waited to see what happened. I checked back and in a few days or so all the pages bar 1 had been crawled and indexed even without any links pointing at the site.
So what happened, why where all the pages indexed in Google, bar the most important homepage?
I checked the source code in the browser for non index elements, checked for any canonical mistakes, checked the history of the site to see if the site had been black listed, but couldn’t figure out the issue. I didn’t think the fact that the content had been on another domain and was non on a new and weak authority site would stop it from being indexed, particularly as only 1 page hadn’t been indexed.
So after a week of scratching my head I decided to add the site to Google Webmaster Tools and verified that it was mine. Next I popped into ‘Diagnostics’ and then clicked on the link ‘Fetch As GoogleBot’ to see if Google was picking up a problem that I wasn’t. When I clicked ‘Fetch’ an error message came back with ‘Fetch Status’ unreachable.
So there it was, GoogleBot was obviously having a problem accessing the page, yet when I checked it in every browser going and in mobiles it worked fine.
Next stop was to download the user agent plugin for Firefox. Switching the User Agent to Googlebot 2.1 and trying to access the site brought up the issue, a nasty error message.
Within the source code of one of the template pages that I had written a very long time ago and not checked when quickly moving the site over, it showed that if the Googlebot spider visited the site then a certain bit of code would be run. The file path to the database file into which the information was to be stored had been hard coded, and so when Googlebot visited the old site the code ran fine but with the new site the file path was incorrect and the code didn’t!
Anyway lesson learned, check to make sure Google is seeing what you want it to see, particularly if it’s a new site.