циклическая ссылка
| prostogorod |
|
|---|---|
|
У меня работает переадрисация с http на https Если набрать http://domain.com перенаправляет на https://domain.com А если набрать http://domain.com/articles/ перенаправляет неправильно на https://domain.com/index.php?rwr=articles/ В .htaccess есть две такие строчки связаные с index.php?rwr RewriteRule ^system/?$ index.php?rwr=system [QSA,NC,NE,L] RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L] Помогите, пожалуйста, настроить правильно редирект Dit bericht is bewerkt door Macik (2016-02-01 19:43, 9 jaren ago) |
| Yusupov |
|
|---|---|
|
В файле .htaccess прописываем:
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
|
| prostogorod |
|
|---|---|
|
У меня это прописано, только так
# RewriteCond %{HTTP:SSL} !1
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
Как Вы указали, на этой странице обнаружена циклическая переадресация У меня включен URL Editor и в конце урла "/" Прошу обратить внимание на этот код в урле index.php?rwr
|
| Macik |
|
|---|---|
https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F Dit bericht is bewerkt door Macik (2016-08-14 10:42, 9 jaren ago) |
| Denisbox |
|
|---|---|
#41348 prostogorod: Этот пример для Apache, у вас Nginx+Apache судя по ошибке о циклической ссылке contact: fonts (at) otlab . ru
|
| prostogorod |
|
|---|---|
#41349 Macik:
Тогда, не могу понять, при наведении на ссылку в браузере вижу http://site.ru/news/v-sele-preobrazhenka , после клика на ссылку в строке url браузера http://site.ru/index.php/?rwr=news/v-sele-preobrazhenka Почему? |
| Macik |
|
|---|---|
#41456 prostogorod:, после клика на ссылку в строке url браузераhttp://site.ru/index.php/?rwr=news/v-sele-preobrazhenka Потому, что что-то отрабатывает не в полной мере. Вот для изучения мой лог: # Запрошенный ресурс news/124337 RewriteBase "/cotwork" [/initial] (3) [perdir cotwork/] add path info postfix: cotwork/news -> cotwork/news/124337 [/initial] (3) [perdir cotwork/] strip per-dir prefix: cotwork/news/124337 -> news/124337 [/initial] (3) [perdir cotwork/] applying pattern '^(en|ru|de|nl|zh_TW|i_sami-no)/(.*)' to uri 'news/124337' [/initial] (3) [perdir cotwork/] add path info postfix: cotwork/news -> cotwork/news/124337 [/initial] (3) [perdir cotwork/] strip per-dir prefix: cotwork/news/124337 -> news/124337 [/initial] (3) [perdir cotwork/] applying pattern '^admin/([a-z0-9]+)' to uri 'news/124337' [/initial] (3) [perdir cotwork/] add path info postfix: cotwork/news -> cotwork/news/124337 [/initial] (3) [perdir cotwork/] strip per-dir prefix: cotwork/news/124337 -> news/124337 [/initial] (3) [perdir cotwork/] applying pattern '^(admin|login|message)(/|\\?|$)' to uri 'news/124337' [/initial] (3) [perdir cotwork/] add path info postfix: cotwork/news -> cotwork/news/124337 [/initial] (3) [perdir cotwork/] strip per-dir prefix: cotwork/news/124337 -> news/124337 [/initial] (3) [perdir cotwork/] applying pattern '^system/?$' to uri 'news/124337' [/initial] (3) [perdir cotwork/] add path info postfix: cotwork/news -> cotwork/news/124337 [/initial] (3) [perdir cotwork/] strip per-dir prefix: cotwork/news/124337 -> news/124337 [/initial] (3) [perdir cotwork/] applying pattern '^([^?]+)' to uri 'news/124337' [/initial] (4) [perdir cotwork/] RewriteCond: input='cotwork/news' pattern='!-f' => matched [/initial] (4) [perdir cotwork/] RewriteCond: input='cotwork/news' pattern='!-d' => matched [/initial] (2) [perdir cotwork/] rewrite 'news/124337' -> 'index.php?rwr=news/124337' [/initial] (3) split uri=index.php?rwr=news/124337 -> uri=index.php, args=rwr=news/124337 [/initial] (3) [perdir cotwork/] add per-dir prefix: index.php -> cotwork/index.php [/initial] (2) [perdir cotwork/] trying to replace prefix cotwork/ with /cotwork [/initial] (5) strip matching prefix: cotwork/index.php -> index.php [/initial] (4) add subst prefix: index.php -> /cotwork/index.php [/initial] (1) [perdir cotwork/] internal redirect with /cotwork/index.php [INTERNAL REDIRECT] [/initial/redir#1] (3) [perdir cotwork/] strip per-dir prefix: cotwork/index.php -> index.php [/initial/redir#1] (3) [perdir cotwork/] applying pattern '^(en|ru|de|nl|zh_TW|i_sami-no)/(.*)' to uri 'index.php' [/initial/redir#1] (3) [perdir cotwork/] strip per-dir prefix: cotwork/index.php -> index.php [/initial/redir#1] (3) [perdir cotwork/] applying pattern '^admin/([a-z0-9]+)' to uri 'index.php' [/initial/redir#1] (3) [perdir cotwork/] strip per-dir prefix: cotwork/index.php -> index.php [/initial/redir#1] (3) [perdir cotwork/] applying pattern '^(admin|login|message)(/|\\?|$)' to uri 'index.php' [/initial/redir#1] (3) [perdir cotwork/] strip per-dir prefix: cotwork/index.php -> index.php [/initial/redir#1] (3) [perdir cotwork/] applying pattern '^system/?$' to uri 'index.php' [/initial/redir#1] (3) [perdir cotwork/] strip per-dir prefix: cotwork/index.php -> index.php [/initial/redir#1] (3) [perdir cotwork/] applying pattern '^([^?]+)' to uri 'index.php' [/initial/redir#1] (4) [perdir cotwork/] RewriteCond: input='cotwork/index.php' pattern='!-f' => not-matched [/initial/redir#1] (1) [perdir cotwork/] pass through cotwork/index.php Т.е. у меня Apache осуществляет внутренний редирект, в строке браузера остается запрошенный URL: site.test/cotwork/news/124337
https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F |
| Roffun |
|
|---|---|
|
А где можно убрать порт из адреса ? В canonical url и в карту сайта попадает :443 Добавлено 2 минуты спустя: Похоже обсуждается здесь Сегодня вышла новость, на этом хостинге раздают бесплатные ssl , установка автоматически, и ip адрес выделяют для сайтов с сертификатами, поэтому решил воспользоваться, можно до 3 сайтов в неделю добавить на получение сертификата.
Добавлено 6 месяцев спустя: На своем сайте для правильной обработки https и удаления дублей в виде www , index.php, index.html, index.htm , слеша в конце, прописываю такие условия:
AddDefaultCharset utf-8
RewriteEngine On
# ==== РЕДИРЕКТ НА HTTPS ====
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ==== РЕДИРЕКТ НА HTTPS БЕЗ WWW ====
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]
# ==== УБРАТЬ СЛЕШ В КОНЦЕ URL ====
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
# ==== УБРАТЬ В КОНЦЕ URL INDEX.(PHP|HTML|HTM) ====
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
Улетел на другую планету, а там почты нету.. https://www.cotonti.com/forums/45298?m=posts
Dit bericht is bewerkt door Roffun (2019-03-05 21:34, 6 jaren ago) |
| Kailo |
|
|---|---|
|
У меня эти директивы не работают, работают такие:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Prevent to load sensible data
<FilesMatch "\.(dat|tpl|inc)$">
order deny,allow
deny from all
</FilesMatch>
# Sitemap shortcut
RewriteRule ^sitemap\.xml$ index.php?r=sitemap [L]
# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]
# System category has priority over /system folder
RewriteRule ^system/?$ index.php?rwr=system [QSA,NC,NE,L]
# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]
<IfModule mod_headers.c>
Header always append X-Frame-Options SAMEORIGIN
</IfModule>
|
| Roffun |
|
|---|---|
#41500 Roffun:
В чем отличие ? #42252 Kailo:
Улетел на другую планету, а там почты нету.. https://www.cotonti.com/forums/45298?m=posts
|
| Kailo |
|
|---|---|
|
Во всем остальном, за исключением www. Слеш и индекс урледитором убираются. Такие директивы с ним без глюков работают:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect at HTTPS without WWW
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]
# Prevent to load sensible data
<FilesMatch "\.(dat|tpl|inc)$">
order deny,allow
deny from all
</FilesMatch>
# Sitemap shortcut
RewriteRule ^sitemap\.xml$ index.php?r=sitemap [L]
# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]
# System category has priority over /system folder
RewriteRule ^system/?$ index.php?rwr=system [QSA,NC,NE,L]
# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]
<IfModule mod_headers.c>
Header always append X-Frame-Options SAMEORIGIN
</IfModule>
А сертификат бесплатный на три года без привязки к хостингу я здесь получил https://startssl.com Dit bericht is bewerkt door Kailo (2016-11-02 08:56, 8 jaren ago) |