Force https in subdomain
  easystem   22 Januari 2018   Tutorial
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$ [NC]
RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

The differrences are:

  1. Specify port 80 not any port containing 80 as digits in the port number.
  2. Specify using No Case.
  3. If both conditions are met, redirect the {REQUEST_URI} to the secure server without duplicating Apache variables for {HTTP_HOST} and {REQUEST_URI}; any query string will not be affected.

Tags :

https , website , apache

Bagikan :