A
A
AdTheBisto2019-01-26 12:34:07
htaccess
AdTheBisto, 2019-01-26 12:34:07

Why is the error "The site redirected too many times." when adding a new redirect to .htaccess?

The point is. You need to create a redirect rule that contains a question mark "?", which makes it impossible to solve the problem using the standard method. Relatively speaking, there is the following way: Of course
test.ru/?page=name
, because of the question mark, ordinary redirects will not work.
In order to register the redirect, the following code was used:

RewriteCond %{QUERY_STRING} ^page=name
RewriteRule ^(.*) https://test.ru/ [R=301,L]

But as a result, when reloading the page, an error occurs:
The site has redirected too many times.
Delete cookies..
ERR_TOO_MANY_REDIRECTS

At the same time, the entire site and other redirects work correctly.
What is the reason? In theory, it should work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-01-26
@AdTheBisto

What is the reason? In theory, it should work.

By default, when redirecting, %{QUERY_STRING} is added.
Need to add "?".
RewriteCond %{QUERY_STRING} ^page=name
RewriteRule ^(.*) https://test.ru/? [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question