I would like to redirect if user open with
1 http://example.com
to https://www.example.com
2 http://www.example.com
to https://www.example.com
3 http://example.com/user/(anystring)
to https://www.example.com/user/(anystring)
4 http://www.example.com/user/(anystring)
to https://www.example.com/user/(anystring)
I've tried this htaccess
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "https\:\/\/www\.example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.com\/user\/*$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com\/user\/*$
RewriteRule ^/?$ "https\:\/\/www\.example\.com\/user\/$1" [R=301,L]
3rd and 4th is not working properly, (anystring)
is not accessible, I'm going to set COOKIE
, but its not available after redirection.