You can just create a .htaccess
file in the subdomain with the contents
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://test.XXXX.org%{REQUEST_URI} [L,R=301]
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS
</IfModule>
Remember, Joomla's Global Configuration option only works for pages rendered by Joomla. When Joomla sees that the URL scheme is http
it will output an HTTP 307 redirection to the same URL but with the https
scheme. It's all done in PHP code.
The .htaccess
code uses a web standard called HSTS. It is an HTTP header send with the server reply which tells the browser “hey, so that you know, you should try to access this site only over HTTPS; this applies for the next 31536000 seconds (1 year)”. The browser sees that and will not even try to use plain old HTTP anymore for that subdomain; it will automatically upgrade the request to HTTPS.
However, this header can only be sent for HTTPS requests. Hence the first five lines which do what Joomla's Force HTTPS does, but at the .htaccess
level.
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!