After several hours of research, I give up!
When I type this: https://scan.example.com (note HTTPS) it works fine.
But when I type this in browser: http://scan.example.com
it goes to: https://example.com/scan (it puts the subdomain at the end)
How do I prevent this and make sure it goes to https://scan.example.com?
Here is my current .htaccess (Which works perfectly for me for everything else besides the issue above):
Options -MultiViews
RewriteEngine On
# HTTP to HTTPS canonical redirect
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://example.com/$1 [R=301,L]
# Abort early if the request already maps to (or looks like) a file or directory
RewriteCond %{REQUEST_URI} \.\w{2,4}$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# 3. Extensionless URLs for other requests
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule (.*) $1.php [L]
*PS: The reason I have example.com/$1 is because I want to be able to access for example account.php in root like this:
https://example.com/account.