Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Переход с HTTP на HTTPS - правильно #361

Open
Kotgo opened this issue Aug 24, 2019 · 6 comments

Comments

@Kotgo
Copy link

commented Aug 24, 2019

Подскажите, пожалуйста, правильный код для .htaccess ,
чтобы правильно настроить полный редирект с HTTP на HTTPS всех страниц и домена, а также с www на домен c HTTPS на MaxsiteCMS.

@maxsite

This comment has been minimized.

Copy link
Owner

commented Aug 24, 2019

Это зависит от сервера. Но в целом, поищите в гугле, там полно примеров.

@Kotgo

This comment has been minimized.

Copy link
Author

commented Sep 1, 2019

Максим, да, примеров много, а ваш рабочий вариант можете показать?

@maxsite

This comment has been minimized.

Copy link
Owner

commented Sep 1, 2019

Я не использую https. Ищите в гугле или уточняйте у своего хостера.

@Kmartynov

This comment has been minimized.

Copy link

commented Sep 14, 2019

@Kotgo Попробуйте следующий вариант
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php index.html
AddDefaultCharset UTF-8

RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|uploads|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?$1 [L,QSA]
@Kotgo

This comment has been minimized.

Copy link
Author

commented Sep 15, 2019

Kmartynov , благодарю вас за вариант, попробую.

@maxsite

This comment has been minimized.

Copy link
Owner

commented Sep 15, 2019

Добавлю в дистрибутив такой вариант. Должен подходить под большинство хостингов.

<IfModule mod_rewrite.c>
RewriteEngine on

# for 301-redirect http to https
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,L] 

RewriteBase /
RewriteCond $1 !^(index\.php|uploads|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA] 
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.