Making the correct HTTP headers 404

(No ratings yet)
Загрузка ... Loading ...

For you are not a secret that I have a few projects on the web. As required I correct mistakes, and just watch them in Yandex.Webmaster . Always better safe than sorry in advance than to detect a failure at the wrong time.

Recently, my attention was again drawn Yandex. This time, the list of indexed pages several times, he showed major. I wondered if the question: what is the reason for this strange display?

Делаем правильные HTTP заголовки 404

Wondering about the situation, I was thinking that I have is not strong enough hosting to "pull" the resources and the search robot because it can not cope with the load of all the pages. So I decided to change the host and, a little while, did not detect any changes. The problem has remained in the same place.

It was decided to work with the code, providing new host server require lower speeds. Opening the file robots.txt, I put in an important guideline for this process Crawl-delay: 3. With it, the search engine spiders will not load all pages of the site simultaneously, and distribute the team through the pages at an interval of 3 seconds.

Such a directive can be implemented only with search engine Yandex. Unfortunately, Google does not see it simply loads the resource and completely. In other words, if your website has a high index of attendance, the server will not be overloaded. Alas, this time the issue of the dual main index page is not exhausted.

Well, it starts to be interesting, I thought at that moment. Is the situation is so desperate that I was not able to solve it? At such moments, you realize that the excitement and solve the puzzle - the cornerstone to help did not stop there.

The idea is not long to wait. Perhaps, I thought, the problem is in the file. Htaccess. He opened it and began to clear something:

  ErrorDocument 404
 RewriteEngine On
 RewriteCond% {HTTP_HOST} ^ ipmoney \. Info $ [NC]
 RewriteRule ^ (. *) $ Http:// $ 1 [R = 301, L]
 - Indexes Options All - Indexes 

That's it! Read the line: ErrorDocument 404 

The point was that when there was a 404 error (no document), the resource redirects the user to the home page That's what I was meant to page form "/ name-with-error", ie incorrectly scored, drew the main page.

Guess? The main point was the directive, which was given absolute address of the web page. Therefore, the algorithm 404 provoked forwarding and delivery of 302 title designating a temporary file transfer.

In other words, the search engine turned to the removal of pages and received command is directed to the main page, this page is not yet on the server. Home re-indexed, giving the face a blog, there is reducing its issuance due to duplicate.

Then I replaced the following line of code: ErrorDocument 404 


  /?p=01 ErrorDocument 404 /? P = 01 

Expect the new index would have been a long time, but the test was required now. The idea is that the code has been fixed and the resource needed to work properly, but it was necessary to act now.

It was necessary to find a service that checks titles site when he responds to requests to different pages. As a result of such a service has been found, although it was more of the work and a good cup of coffee.

It turned out to work with him nice and simple - I typed the following list of "URLs" to verify the correctness of their actions:

The answer was:

Yes, I did it! Relief and satisfaction relaxed my body and mind - all right.

However, if these lines of code so far presented you with something mysterious

If you do not understand why we need the line

  RewriteCond% {HTTP_HOST} ^ ipmoney \. Info $ [NC]
 [R= 301 ,L] RewriteRule ^ (. *) $ Http:// $ 1 [R = 301, L] 

I advise to read about the preservation of link popularity .

Last modified: 10/08/2013 at 08:17
Published: Saturday, April 11, 2009 at 18:21
Choose the language:

Comments: 4

Average bar: 4.96 out of 5
  1. Alex Leo
    April 12, 2009 at 21:37

    It will be necessary to correct everywhere. Htaccess. Why in the engines are not built-in as standard? :(


  2. GPS
    April 17, 2009 at 18:05

    Realtime plug-in for displaying service HTTP headers directly in firefox:


  3. richkeeper
    May 2, 2009 at 16:01

    Interestingly, I did not even know about it. It will be necessary, and his. Htaccess file to register.


  4. hamanchi
    November 29, 2009 at 10:58

    Damn, spent a whole day to find a solution to the problem 404. Thank you!


Have something to say? Do not be silent!

Your comment will appear after being moderated.
Spam and off-topic posts are deleted.

To insert php-code, use the tag:
<pre lang="php"> php-code </ pre>

I'm not a spammer!