Kaktus Posted December 29, 2017 Report Share Posted December 29, 2017 Здравствуйте!Установил SSL сертификат.В .htaccess добавил: RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]При открытии http://omskcoins.ruперекидывает на https:_//omskcoins.ru/index.php?module=MainView&page_url=При открытии http:_//omskcoins.ru/products/rossiya_25_rubley_2017_strelba_iz_karabinaперекидывает на https:_//omskcoins.ru/index.php?module=ProductView&product_url=rossiya_25_rubley_2017_strelba_iz_karabinaКак сделать так, чтобы в обоих случаях добавлялась буква s в http:// и больше ничего? Quote Link to post Share on other sites
Maksclub Posted December 29, 2017 Report Share Posted December 29, 2017 RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www\.site\.ru$ [NC] RewriteCond %{REQUEST_URI} !^/robots.* RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L] Quote Link to post Share on other sites
Kaktus Posted December 29, 2017 Author Report Share Posted December 29, 2017 Заменил на RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://omskcoins.ru/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www\.omskcoins\.ru$ [NC] RewriteCond %{REQUEST_URI} !^/robots.* RewriteRule ^(.*)$ https://omskcoins.ru/$1 [R=301,L] Ничего не поменялось. Quote Link to post Share on other sites
Solution STM Posted December 29, 2017 Solution Report Share Posted December 29, 2017 RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] и в api/Config.php удалить 46 и 47 строки. $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'? 'https' : 'http'; if($_SERVER["SERVER_PORT"] == 443) чтобы осталось только // Протокол $protocol = 'https'; Quote Link to post Share on other sites
Kaktus Posted December 30, 2017 Author Report Share Posted December 30, 2017 RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www\.site\.ru$ [NC] RewriteCond %{REQUEST_URI} !^/robots.* RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L] RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] и в api/Config.php удалить 46 и 47 строки. $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'? 'https' : 'http'; if($_SERVER["SERVER_PORT"] == 443) чтобы осталось только // Протокол $protocol = 'https'; Спасибо Вам за помощь, но ситуация не изменилась. Quote Link to post Share on other sites
Kaktus Posted December 30, 2017 Author Report Share Posted December 30, 2017 Вот так выглядит .htaccess в корне сайта AddDefaultCharset UTF-8 ErrorDocument 404 /404 ErrorDocument 401 /password.php RewriteEngine on # Админка теперь по адресу /simpla RewriteRule ^admin/?$ simpla [L] # Каталог товаров RewriteRule ^catalog/([^/]+)/?$ index.php?module=ProductsView&category=$1 [L,QSA] RewriteRule ^catalog/([^/]+)/([^/]+)/?$ index.php?module=ProductsView&category=$1&brand=$2 [L,QSA] RewriteRule ^products/([^/]+)/?$ index.php?module=ProductView&product_url=$1 [L,QSA] RewriteRule ^products/?$ index.php?module=ProductsView [L,QSA] RewriteRule ^brands/([^/]+)/?$ index.php?module=ProductsView&brand=$1 [L,QSA] RewriteRule ^brands/([^/]+)/page_([^/]+)/?$ index.php?module=ProductsView&brand=$1&page=$2 [L,QSA] # Поиск товаров RewriteRule ^search/([^/]+)/?$ index.php?module=ProductsView&keyword=$1 [L,QSA] RewriteRule ^search/?$ index.php?module=ProductsView [L,QSA] # Блог RewriteRule ^blog/([^/]+)/?$ index.php?module=BlogView&url=$1 [L,QSA] RewriteRule ^blog/?$ index.php?module=BlogView [L,QSA] # Корзина и заказы RewriteRule ^cart/?$ index.php?module=CartView [L,QSA] RewriteRule ^cart/([^/]+)/?$ index.php?module=CartView&add_variant=$1 [L,QSA] RewriteRule ^cart/remove/([^/]+)/?$ index.php?module=CartView&delete_variant=$1 [L,QSA] RewriteRule ^order/([^/]+)/?$ index.php?module=OrderView&url=$1 [L,QSA] RewriteRule ^order/?$ index.php?module=OrderView [L,QSA] # Для пользователей RewriteRule ^user/login/?$ index.php?module=LoginView [L,QSA] RewriteRule ^user/register/?$ index.php?module=RegisterView [L,QSA] RewriteRule ^user/logout/?$ index.php?module=LoginView&action=logout [L,QSA] RewriteRule ^user/password_remind/?$ index.php?module=LoginView&action=password_remind [L,QSA] RewriteRule ^user/password_remind/([0-9a-z]+)/?$ index.php?module=LoginView&action=password_remind&code=$1 [L,QSA] RewriteRule ^user/?$ index.php?module=UserView [L,QSA] # Google sitemap RewriteRule ^sitemap.xml?$ sitemap.php [L,QSA] # XML RewriteRule ^yandex.xml?$ yandex.php [L,QSA] # feedback RewriteRule ^contact/?$ index.php?module=FeedbackView [L,QSA] #downloads RewriteRule ^order/([^/]+)/([^/]+)/?$ index.php?module=OrderView&url=$1&file=$2 [L,QSA] # Статические страницы RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/?$ index.php?module=PageView&page_url=$1 [L,QSA] RewriteRule ^/?$ index.php?module=MainView&page_url= [L,QSA] # Ресайз картинок на лету RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^files/products/(.+) resize/resize.php?file=$1&token=%{QUERY_STRING} #RewriteCond %{THE_REQUEST} ^GET\ (.*)files/products/(.*)\?([A-z0-9]*) #RewriteRule ^files/products/(.+) resize/resize.php?file=%2&token=%3 [L,NE] RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Вызывает подозрения # Статические страницы RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/?$ index.php?module=PageView&page_url=$1 [L,QSA] RewriteRule ^/?$ index.php?module=MainView&page_url= [L,QSA] Quote Link to post Share on other sites
Kosjak76 Posted December 30, 2017 Report Share Posted December 30, 2017 Блин, вам же говорили, куда вставлять RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Надо вставлять сразу послеRewriteEngine onа не в конец файла Quote Link to post Share on other sites
Kaktus Posted December 30, 2017 Author Report Share Posted December 30, 2017 Блин, вам же говорили, куда вставлять RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Надо вставлять сразу послеRewriteEngine onа не в конец файлаСпасибо, исправил. Переадресация с товаров и категорий идет правильно, а с главной все еще нет. Quote Link to post Share on other sites
Kaktus Posted December 30, 2017 Author Report Share Posted December 30, 2017 При открытии http://omskcoins.ru все еще перекидывает на https:_//omskcoins.ru/index.php?module=MainView&page_url= Как это исправить? Quote Link to post Share on other sites
yr4ik Posted December 30, 2017 Report Share Posted December 30, 2017 (edited) Если браузер хромоподобный то там есть кеш редиректов. Попробуйте закрыть открыть браузер Edited December 30, 2017 by yr4ik Quote Link to post Share on other sites
Kaktus Posted December 31, 2017 Author Report Share Posted December 31, 2017 (edited) Если браузер хромоподобный то там есть кеш редиректов. Попробуйте закрыть открыть браузерВерно, браузер не закрывал несколько дней.Работает, всем спасибо и с наступающим! Edited December 31, 2017 by Kaktus Quote Link to post Share on other sites
Kluva Posted January 12, 2018 Report Share Posted January 12, 2018 А если после подключения ssl, и настройки htacces & confige - на https послетали все стили, куда копать? Quote Link to post Share on other sites
mistika Posted January 15, 2018 Report Share Posted January 15, 2018 (edited) хм.. сделала все так как написано уважаемым Кактусом, но что-то пошло не так, вместо редиректа морда начала открываться частично, навигация есть. а вместо витрины 404 страницу выдавать, при попытке перейти в любой раздел каталога редирект таки заработал, но если руками опять набрать www.site.ru то опять 404.Плюс у меня небольшой вопрос а вот эта красота из htacess теперь мусор или как? RewriteCond %{HTTP_HOST} !^www.site\.ru [NC]RewriteRule ^(.*) http://www.site.ru/$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_URI} ^(.+)/$RewriteRule ^(.+)/$ /$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/RewriteRule ^(.*)index\.(php|html|htm)$ http://www.site.ru/$1 [R=301,L] у меня по всему интернету во всех вариантах раскидано много ссылок и если кто кликнет хотелось бы чтобы на хттпс переносило. Я имею в виду старые site.ru www.site.ru и др.. к сожалению. htacess совсем не моё. Так же хотелось бы уточнить про вот этоRewriteCond %{REQUEST_URI} !^/robots.* Оно надо или нет все таки?Спасибо всем, кто ответит по теме Edited January 15, 2018 by mistika Quote Link to post Share on other sites
Volnorez Posted March 18, 2018 Report Share Posted March 18, 2018 Здравствуйте, переехал на https, но <link rel="canonical" href="http:// отдает без https:// подскажите где копать? Quote Link to post Share on other sites
Gruzin Posted November 26, 2018 Report Share Posted November 26, 2018 (edited) . Edited November 26, 2018 by Gruzin Quote Link to post Share on other sites
andreas81 Posted June 2, 2019 Report Share Posted June 2, 2019 (edited) Привет, код брал из начала поста. У меня 2.3.7 - все нормально. Спасибо за пост. Edited June 2, 2019 by andreas81 Quote Link to post Share on other sites
alexeymdagency Posted September 18, 2019 Report Share Posted September 18, 2019 RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] и в api/Config.php удалить 46 и 47 строки. $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'? 'https' : 'http'; if($_SERVER["SERVER_PORT"] == 443) чтобы осталось только // Протокол $protocol = 'https'; Спасибо это работает Quote Link to post Share on other sites
alexeymdagency Posted September 18, 2019 Report Share Posted September 18, 2019 А если после подключения ssl, и настройки htacces & confige - на https послетали все стили, куда копать? шаблон index.tpl смотри и меняй http на https Quote Link to post Share on other sites
Viktoria Posted October 4, 2019 Report Share Posted October 4, 2019 Добрый день, пытаюсь перейти на https, воспользовалась советом http://forum.simplacms.ru/topic/13261-переадресация-с-http-на-https-ssl-сертификат/?p=103371Однако вообще ничего не изменилось...в чем может быть причина? Quote Link to post Share on other sites
Kami Posted October 5, 2019 Report Share Posted October 5, 2019 Добрый день, пытаюсь перейти на https, воспользовалась советом http://forum.simplacms.ru/topic/13261-переадресация-с-http-на-https-ssl-сертификат/?p=103371Однако вообще ничего не изменилось...в чем может быть причина? какая версия у вас? Quote Link to post Share on other sites
sypro Posted April 16, 2020 Report Share Posted April 16, 2020 RewriteEngine OnRewriteCond %{ENV:HTTPS} !onRewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Quote Link to post Share on other sites
xikarx Posted August 31, 2020 Report Share Posted August 31, 2020 Уважаемые, а подскажите как победить обратную траблу? По рецепту, закрепленному в начале этой ветки давно и надежно живу на https на сервере (в интернетах). Но вот появилась необходимость поработать с сайтом на локалке, на денвере.Скачал сайт с сервера, убрал из htaccess RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] вернул как было в api/Config.php 46 и 47 строки, чтоб стало $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'? 'https' : 'http'; if($_SERVER["SERVER_PORT"] == 443) $protocol = 'https'; Для надежности раскомментил в C:\WebServers\usr\local\php5\php.ini строку ;extension=php_openssl.dll но при попытке открыть сайт с денвера получаю 500 ошибку. В логах сервера вижу такое: localhost:443:0 server certificate does NOT include an ID which matches the server name[Tue Sep 01 01:08:00.411409 2020] [mpm_winnt:notice] [pid 10252:tid 268] AH00354: Child: Starting 64 worker threads.[Tue Sep 01 01:08:14.014187 2020] [core:alert] [pid 10252:tid 948] [client 127.0.0.1:55217] Z:/home/astra-omsk.ru/www/.htaccess: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration что и где я не доделал? почему денвер по прежнему видит сертификат? как победить? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.