1

Google Webmaster Tools is reporting strange crawl errors. It reports that www.example.com can't be found, yet the domain is valid and is an exact match of our clients domain.

A click on the error shows me a more detailed error, but somehow more abstract - when I click on the second tab - from where it comes:

Crawl error

What is the problem here? Is it because of our .htaccess?

We had to redirect for some several reasons:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  • That would tell me that somewhere in the source you are linking to domain+domain. View source and search your a hrefs. – Simon Hayter Sep 11 '15 at 7:55
  • I'm pretty sure all links are correct, but i take a look. And thanks for the edit!! – moesphemie Sep 11 '15 at 7:56
  • You don't need to be explicitly linking to domain+domain. If you have relative URLs that were missing the scheme eg. <a href="www.example.com/path/to/file". However, the list you are showing is the list of URLs that are linking to the erroneous page - I would have thought these pages must exist? Your .htaccess looks OK. – MrWhite Sep 11 '15 at 8:19
  • @w3d your example is an absolute link, isn't it? All over the whole page we used relative links, except the links to external pages of course… The pages do exist, yes except the last one dr-bloch.de/www.dr-bloch.de - The project management told me that the host we've chosen always creates two types of links: foo.tld and www.foo.tld which led us to create that specific htaccess-rule. It's strange – moesphemie Sep 11 '15 at 8:27
  • No, my example is a (malformed) relative link. If this link appeared in a page in the document root, then the resulting URL is http://www.example.com/www.example.com/path/to/file - which shouldn't exist. An absolute URL would be: <a href="http://www.example.com/path/to/file" (ie. with a scheme). – MrWhite Sep 11 '15 at 8:33
1

The problem is how you craft your hyperlinks on your page.

For example, if your page is reached at http://www.example.com and you created a link using the following code:

<a href="example.com">Some page</a>

You got a problem. The reason is because "example.com" here counts as a relative URL and clicking on it will cause it to append to your old URL so therefore, you get http://www.example.com/example.com.

An easy way out (if you're willing to make the code size bigger) is to make the URL absolute. The following is a code for a link to an absolute URL:

<a href="http://www.example.com">Some page</a>

When you access absolute URLs, the entire URL is replaced in the address bar of your browser with the new URL.

Start with absolute URLs for all links to make sure they all work first. Then later, do some research on relative URLs and convert the links over if you want to save bandwidth.

  • Thanks for the answer, Maik. I'm gonna try this out on monday when i'm back at the office 😊I'll check this out and give you an answer! – moesphemie Sep 11 '15 at 21:04
  • 1
    hey mike, before i started to change all the links i had the idea to just add a base href and it works :) – moesphemie Sep 14 '15 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.