Home computickets Server responds with a redirect to Robots.txt request. Redirect via Web.config

Server responds with a redirect to Robots.txt request. Redirect via Web.config

Author

Date

Category

I can’t find the right solution.
Yandex says that the robots.txt file should be excluded from the HTTP redirect on HTTPS.
I can not find a ready-made solution.

web.config file:

& lt; configuration & gt;
  & lt; System.WebServer & GT;
    & lt; rewrite & gt;
      & lt; rules & gt;
        & lt; rule name = "redirect to https" stopprocessing = "True" & gt;
          & lt; match url = "(. *)" / & gt;
          & lt; Conditions & gt;
            & lt; add input = "{https}" pattern = "off" ignorecase = "true" / & gt;
          & lt; / Conditions & gt;
          & lt; action type = "redirect" url = "https: // {http_host} {request_uri}" redirecttype = "permanent" / & gt;
        & lt; / rule & gt;
      & lt; / rules & gt;
    & lt; / rewrite & gt;
  & lt; /system.webserver>
& lt; / configuration & gt;

tried like this – does not want to work:

& lt; configuration & gt;
  & lt; System.WebServer & GT;
    & lt; rewrite & gt;
      & lt; rules & gt;
        & lt; rule name = "redirect to https" stopprocessing = "True" & gt;
          & lt; match url = "(. *)" / & gt;
          & lt; Conditions logicalGrouping = "Matchall" & gt;
            & lt; add input = "{https}" pattern = "off" ignorecase = "true" / & gt;
            & lt; add input = "{Request_uri}" negate = "true" pattern = "^ / robots \ .txt $" ignorecase = "true" / & gt;
          & lt; / Conditions & gt;
          & lt; action type = "redirect" url = "https: // {http_host} {request_uri}" redirecttype = "permanent" / & gt;
        & lt; / rule & gt;
      & lt; / rules & gt;
    & lt; / rewrite & gt;
  & lt; /system.webserver>
& lt; / configuration & gt;

Answer 1

I was looking for solutions for so long that I forgot the most elementary. Clean the cache browsers. . . So the solution is fully working.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions