Skip to content

Instantly share code, notes, and snippets.

@kovtunos
Last active September 29, 2017 14:10
Show Gist options
  • Select an option

  • Save kovtunos/60c41b2f36b91c9b637535fff2a0d1c6 to your computer and use it in GitHub Desktop.

Select an option

Save kovtunos/60c41b2f36b91c9b637535fff2a0d1c6 to your computer and use it in GitHub Desktop.
Redirect to HTTPS #drupal #htaccess
# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect to HTTPS
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www.example\.com*
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]
# Redirect to HTTPS
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# Redirect to HTTPS
RewriteCond %{HTTPS} =on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
// Drupal settings.php
$base_url = 'https://my.domain.name';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment