I need to:
add www, so user will:
- type
https://example.com/test.html
- see in browser
https://www.example.com/test.html
- get file from
example.com/test.html
- type
add http -> https redirect, so user will:
- type
http://www.example.com/test.html
- see in browser
https://www.example.com/test.html
- get file from
example.com/test.html
- type
add subdomain silent redirect, so user will:
- type
https://new.example.com/test.html
- see in browser
https://new.example.com/test.html
- get file from
example.com/new/test.html
- type
and of course combinated, for example:
- type
http://new.example.com/test.html
- see in browser
https://new.example.com/test.html
- get file from
example.com/new/test.html
- type
Is this possible via .htaccess file, eventually how?
www and https forwarding is already working fine for me, but I do not know, how to do silent forwaring with subdomains:
RewriteEngine On
# https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# WWW
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^new\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Thank you.