A
A
Alexander2015-10-02 17:29:34
PHP
Alexander, 2015-10-02 17:29:34

Why does it transfer from the site to Yandex?

Friends. I just can’t understand what’s the matter..
There is a category on the site.. https://site.ru/gotovim-edu/
There is a condition in .htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)(?<!/)$ /$1/ [L,R=301]

If you turn to the page:
https://site.ru/gotovim-edu
, then it throws it to Yandex with a url-string in the Yandex search.
If you turn to https://site.ru/gotovi-edu
, then there is a redirect to the category https://site.ru/gotovim-edu/ (as it should be) I
thought it was a "dash", but when accessing the https category ://site.ru/na-dvoih
redirects to https://site.ru/na-dvoih/ (everything is correct)
Tell me, what could be the reason? Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Novikov, 2015-10-02
@dmitriy_novikov

Are you trying to redirect from addresses without a trailing slash to addresses with a slash?
Try to google ready-made examples. For example:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

And the error occurs because your url is formed without https://site.ru , and the browser perceives this as a search query entered in the address bar. therefore, it redirects to the search engine installed in the default browser.

E
EvgeniyKonstantinov, 2015-10-02
@EvgeniyKonstantinov

You are thrown not to Yandex, but to a non-valid url, which your browser interprets as not valid and instead of going through it tries to find it in the default search, which you apparently have Yandex.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question