Title: Бесконечный redirect (infinite redirect loop)
Last modified: 28.07.2017

---

# Бесконечный redirect (infinite redirect loop)

 *  Решено [justfree](https://ru.wordpress.org/support/users/justfree/)
 * (@justfree)
 * [9 лет, 7 месяцев назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/)
 * Решил поставить wordpress на хостинг и столкнулся со следующей проблемой. При
   обращении непосредственно к блогу, например, [https://www.example.com/](https://www.example.com/),
   wordpress впадает в бесконечный цикл — отправляет 301 redirect (браузер выдает
   ошибку ERR_TOO_MANY_REDIRECT).
 * Схема хостинга выглядит следующим образом:
 * USER BROWSER — HTTPS — CLOUDFLARE — HTTPS — NGINX — HTTP — APACHE
 * Подключил php debug_trace на функцию wp-redirect и не могу понять, в чем косяк,
   может быть кто-нибудь подскажет?
 *     ```
       Sat, 15 Apr 2017 23:38:20 +0000 IP: 127.0.0.1 Location: [https://www.example.com/], Status [301]
       Backtrace
       array (
         0 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/class-wp-hook.php',
           'line' => 298,
           'function' => 'orb_dbg_redirect_trbl',
           'args' => 
           array (
             0 => 'https://www.example.com/',
             1 => 301,
           ),
         ),
         1 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/plugin.php',
           'line' => 203,
           'function' => 'apply_filters',
           'class' => 'WP_Hook',
           'object' => 
           WP_Hook::__set_state(array(
              'callbacks' => 
             array (
               1 => 
               array (
                 '000000005c052acc000000000897bca8wp_redirect' => 
                 array (
                   'function' => 
                   array (
                     0 => 
                     WordPress_Module::__set_state(array(
                        'matched' => false,
                     )),
                     1 => 'wp_redirect',
                   ),
                   'accepted_args' => 2,
                 ),
               ),
               100 => 
               array (
                 'orb_dbg_redirect_trbl' => 
                 array (
                   'function' => 'orb_dbg_redirect_trbl',
                   'accepted_args' => 2,
                 ),
               ),
             ),
              'iterations' => 
             array (
               0 => 
               array (
                 0 => 1,
                 1 => 100,
               ),
             ),
              'current_priority' => 
             array (
               0 => 100,
             ),
              'nesting_level' => 1,
              'doing_action' => false,
           )),
           'type' => '->',
           'args' => 
           array (
             0 => 'https://www.example.com/',
             1 => 
             array (
               0 => 'https://www.example.com/',
               1 => 301,
             ),
           ),
         ),
         2 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/pluggable.php',
           'line' => 1159,
           'function' => 'apply_filters',
           'args' => 
           array (
             0 => 'wp_redirect',
             1 => 'https://www.example.com/',
             2 => 301,
           ),
         ),
         3 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/canonical.php',
           'line' => 516,
           'function' => 'wp_redirect',
           'args' => 
           array (
             0 => 'https://www.example.com/',
             1 => 301,
           ),
         ),
         4 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/class-wp-hook.php',
           'line' => 298,
           'function' => 'redirect_canonical',
           'args' => 
           array (
             0 => 'https://www.example.com/index.php',
           ),
         ),
         5 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/class-wp-hook.php',
           'line' => 323,
           'function' => 'apply_filters',
           'class' => 'WP_Hook',
           'object' => 
           WP_Hook::__set_state(array(
              'callbacks' => 
             array (
               0 => 
               array (
                 '_wp_admin_bar_init' => 
                 array (
                   'function' => '_wp_admin_bar_init',
                   'accepted_args' => 1,
                 ),
               ),
               10 => 
               array (
                 'redirect_canonical' => 
                 array (
                   'function' => 'redirect_canonical',
                   'accepted_args' => 1,
                 ),
                 '000000005c052acc000000000897bca8template_redirect' => 
                 array (
                   'function' => 
                   array (
                     0 => 
                     WordPress_Module::__set_state(array(
                        'matched' => false,
                     )),
                     1 => 'template_redirect',
                   ),
                   'accepted_args' => 1,
                 ),
               ),
               11 => 
               array (
                 'rest_output_link_header' => 
                 array (
                   'function' => 'rest_output_link_header',
                   'accepted_args' => 0,
                 ),
                 'wp_shortlink_header' => 
                 array (
                   'function' => 'wp_shortlink_header',
                   'accepted_args' => 0,
                 ),
               ),
               20 => 
               array (
                 'wpcf7_cleanup_upload_files' => 
                 array (
                   'function' => 'wpcf7_cleanup_upload_files',
                   'accepted_args' => 1,
                 ),
                 'wpcf7_cleanup_captcha_files' => 
                 array (
                   'function' => 'wpcf7_cleanup_captcha_files',
                   'accepted_args' => 1,
                 ),
               ),
               1000 => 
               array (
                 'wp_redirect_admin_locations' => 
                 array (
                   'function' => 'wp_redirect_admin_locations',
                   'accepted_args' => 1,
                 ),
               ),
             ),
              'iterations' => 
             array (
               0 => 
               array (
                 0 => 0,
                 1 => 10,
                 2 => 11,
                 3 => 20,
                 4 => 1000,
               ),
             ),
              'current_priority' => 
             array (
               0 => 10,
             ),
              'nesting_level' => 1,
              'doing_action' => true,
           )),
           'type' => '->',
           'args' => 
           array (
             0 => false,
             1 => 
             array (
               0 => '',
             ),
           ),
         ),
         6 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/plugin.php',
           'line' => 453,
           'function' => 'do_action',
           'class' => 'WP_Hook',
           'object' => 
           WP_Hook::__set_state(array(
              'callbacks' => 
             array (
               0 => 
               array (
                 '_wp_admin_bar_init' => 
                 array (
                   'function' => '_wp_admin_bar_init',
                   'accepted_args' => 1,
                 ),
               ),
               10 => 
               array (
                 'redirect_canonical' => 
                 array (
                   'function' => 'redirect_canonical',
                   'accepted_args' => 1,
                 ),
                 '000000005c052acc000000000897bca8template_redirect' => 
                 array (
                   'function' => 
                   array (
                     0 => 
                     WordPress_Module::__set_state(array(
                        'matched' => false,
                     )),
                     1 => 'template_redirect',
                   ),
                   'accepted_args' => 1,
                 ),
               ),
               11 => 
               array (
                 'rest_output_link_header' => 
                 array (
                   'function' => 'rest_output_link_header',
                   'accepted_args' => 0,
                 ),
                 'wp_shortlink_header' => 
                 array (
                   'function' => 'wp_shortlink_header',
                   'accepted_args' => 0,
                 ),
               ),
               20 => 
               array (
                 'wpcf7_cleanup_upload_files' => 
                 array (
                   'function' => 'wpcf7_cleanup_upload_files',
                   'accepted_args' => 1,
                 ),
                 'wpcf7_cleanup_captcha_files' => 
                 array (
                   'function' => 'wpcf7_cleanup_captcha_files',
                   'accepted_args' => 1,
                 ),
               ),
               1000 => 
               array (
                 'wp_redirect_admin_locations' => 
                 array (
                   'function' => 'wp_redirect_admin_locations',
                   'accepted_args' => 1,
                 ),
               ),
             ),
              'iterations' => 
             array (
               0 => 
               array (
                 0 => 0,
                 1 => 10,
                 2 => 11,
                 3 => 20,
                 4 => 1000,
               ),
             ),
              'current_priority' => 
             array (
               0 => 10,
             ),
              'nesting_level' => 1,
              'doing_action' => true,
           )),
           'type' => '->',
           'args' => 
           array (
             0 => 
             array (
               0 => '',
             ),
           ),
         ),
         7 => 
         array (
           'file' => '/opt/example.com/html/wp-includes/template-loader.php',
           'line' => 12,
           'function' => 'do_action',
           'args' => 
           array (
             0 => 'template_redirect',
           ),
         ),
         8 => 
         array (
           'file' => '/opt/example.com/html/wp-blog-header.php',
           'line' => 19,
           'args' => 
           array (
             0 => '/opt/example.com/html/wp-includes/template-loader.php',
           ),
           'function' => 'require_once',
         ),
         9 => 
         array (
           'file' => '/opt/example.com/html/index.php',
           'line' => 17,
           'args' => 
           array (
             0 => '/opt/example.com/html/wp-blog-header.php',
           ),
           'function' => 'require',
         ),
       )
       ```
   
 * Результат проверки плагином на совместимость с SSL:
 *     ```
       Array
       (
           [HTTPS] => on
           [HTTP_X_FORWARDED_PROTO] => https
           [HTTP_X_REAL_IP] => XX.XXX.XXX.XXX
           [HTTP_X_FORWARDED_FOR] => XX.XXX.XXX.XXX
           [HTTP_X_SCHEME] => https
           [HTTP_CF_IPCOUNTRY] => RU
           [HTTP_CF_RAY] => XXXXXXXXXXX-LHR
           [HTTP_CF_VISITOR] => {"scheme":"https"}
           [HTTP_X_COMPRESS] => null
           [HTTP_CF_CONNECTING_IP] => XX.XXX.XXX.XXX
           [REQUEST_SCHEME] => http
       )
       ```
   
 * правила mod_rewrite:
 *     ```
       	<IfModule mod_rewrite.c>
       		RewriteEngine On
       		RewriteBase /
       		RewriteRule ^index\.php$ - [L]
       		RewriteCond %{REQUEST_FILENAME} !-f
       		RewriteCond %{REQUEST_FILENAME} !-d
       		RewriteRule . /index.php [L]
       	</IfModule>
       ```
   
 * PS: Админка доступна. Инсталляция свежая (практически без plug’инов, пробовал
   доставить SSL плагин и cloudflare, но это не решило проблему).

Просмотр 7 ответов — с 1 по 7 (всего 7)

 *  Модератор [Yui](https://ru.wordpress.org/support/users/fierevere/)
 * (@fierevere)
 * 永子
 * [9 лет, 7 месяцев назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-246884)
 * попробуйте в wp-config.php задать переменные
 *     ```
       $_SERVER['HTTPS'] = 'on';
       $_SERVER['REQUEST_SCHEME'] = 'https';
       ```
   
 *  [hawktv](https://ru.wordpress.org/support/users/hawktv/)
 * (@hawktv)
 * [9 лет, 7 месяцев назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-246925)
 * Та же самая проблема, при попытке перехода на страницы со списками товаров происходит
   бутлуп. При том, это происходит лишь в той ситуации, когда я листаю списки в 
   разделе брендов, на главной странице такой проблемы нету.
    Сайт я не знаю можно
   ли здесь писать, если можно, то скину в следующем сообщении
 *  [Flector](https://ru.wordpress.org/support/users/flector/)
 * (@flector)
 * [9 лет, 7 месяцев назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-246926)
 * каким кодом у вас редирект на https осуществляется?
 *  Модератор [Yui](https://ru.wordpress.org/support/users/fierevere/)
 * (@fierevere)
 * 永子
 * [9 лет, 7 месяцев назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-246927)
 * [@hawktv](https://ru.wordpress.org/support/users/hawktv/)
    причина и лечение 
   вашей проблемы могут быть совсем иными чем у ТС [правила форума п.2](https://ru.wordpress.org/support/forum-rules/)**
   Не задавайте вопросы в чужих темах — для полноценного обсуждения создайте свою.**
 * ps: сайт писать можно и даже желательно, но не в этой (не вашей теме), а в своей
 *  Автор [justfree](https://ru.wordpress.org/support/users/justfree/)
 * (@justfree)
 * [9 лет, 7 месяцев назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-247298)
 * Ошибка была в nginx конфиге. Решено.
    Всем спасибо за участие.
 *  [dimaaks](https://ru.wordpress.org/support/users/dimaaks/)
 * (@dimaaks)
 * [9 лет, 3 месяца назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-255294)
 * Добрый день, поделитесь решением мучаюсь уже 3 день.
 *  Модератор [Yui](https://ru.wordpress.org/support/users/fierevere/)
 * (@fierevere)
 * 永子
 * [9 лет, 3 месяца назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-255303)
 * dimaaks
 * создайте отдельную тему со своим вопросом, и поподобнее,
    а то по вашему сообщению
   выше, даже не понятно с чем вы мучаетесь

Просмотр 7 ответов — с 1 по 7 (всего 7)

 Тема «Бесконечный redirect (infinite redirect loop)» закрыта для новых ответов.

## Метки

 * [301](https://ru.wordpress.org/support/topic-tag/301/)
 * [apache](https://ru.wordpress.org/support/topic-tag/apache/)
 * [Cloudflare](https://ru.wordpress.org/support/topic-tag/cloudflare/)
 * [debug trace](https://ru.wordpress.org/support/topic-tag/debug-trace/)
 * [nginx](https://ru.wordpress.org/support/topic-tag/nginx/)
 * [php](https://ru.wordpress.org/support/topic-tag/php/)
 * [redirect loop](https://ru.wordpress.org/support/topic-tag/redirect-loop/)
 * [ssl](https://ru.wordpress.org/support/topic-tag/ssl/)
 * [WordPress](https://ru.wordpress.org/support/topic-tag/wordpress/)

 * Форум: [Проблемы и решения](https://ru.wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 ответов
 * 5 участников
 * Последний ответ: [Yui](https://ru.wordpress.org/support/users/fierevere/)
 * Последняя активность: [9 лет, 3 месяца назад](https://ru.wordpress.org/support/topic/%d0%b1%d0%b5%d1%81%d0%ba%d0%be%d0%bd%d0%b5%d1%87%d0%bd%d1%8b%d0%b9-redirect-infinite-redirect-loop/#post-255303)
 * Статус: решённая

## Темы

### Самые популярные темы

### Темы без ответов

### Без вопроса

### Решённые

### Нерешённые

### Все темы
