redirect
Title: Redirecting All Users to HTTPS, Except for Specific IPs Using .htaccess
Introduction:
In web development, sometimes you may want to redirect all users accessing your website to a specific URL, such as www.example.com. However, there might be certain cases where you need to exclude specific IP addresses from this redirection. In this article, we will explore how to achieve this using the .htaccess file.
Redirect Drupal 8 to https instead of http
add this code to .htaccess
#1
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]# 2 Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]