1

My app allow users to create a page using a subdomain, so I have hundreds of subdomains.

I bought a Wildcard certificate and it works fine when you type the complete URL:

https://foo.mydomain.com
https://bar.mydomain.com
https://foo.mydomain.com/controller/method/argument
https://bar.mydomain.com?id=234

However I doesn't work if you miss to type HTTPS:// In that case you will be redirected to the root domain (mydomain.com)

My intention is to force HTTPS while keeping the URL.

This is what I have in my htaccess file

RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]

Thanks for your help.

Chiste
  • 66
  • 5
  • That should work, what's the problem? As long as you are specifying `RewriteEngine on` before it. Line two is not needed, it's covered by the first line. The NE flag is not needed either. –  Jan 10 '17 at 00:48
  • The problem is that when someone types it is redirected to when it should redirect to . Maybe it is not related to this. Thanks for your comment. – Chiste Jan 10 '17 at 14:43

0 Answers0