apache - Want to redirect TLD domain to a subdomain on https with htaccess. Tried htaccess RewriteRule Redirect found but not working -


i want redirect via .htaccess directives these:

http://domain.com , www.domain.com , http://subdomain.domain.com

to :

https://subdomain.domain.com

please note "subdomain" unique subdomain, not want redirect subdomain one.

i'm not familiar .htaccess directives tried rewriterule or redirect snippet found here or elsewere, it's not working. must miss something.

edit: added .htaccess sur directory of subdomain , works now: it's ok, added in htaccess subdirectory of subdomain :

rewritecond %{https} off rewriterule .* https://%{http_host}%{request_uri} [l,r=301] 

try with:

# main domain rewritecond %{http_host} ^(www\.)?domain\.com$ [nc] rewriterule ^ https://subdomain.domain.com%{request_uri} [r=301,l,ne]  # sub domain rewritecond %{http_host} ^(www\.)?subdomain\.domain\.com$ [nc] rewritecond %{https} off [or] rewritecond %{http_host} ^www\. [nc] rewriterule ^ https://subdomain.domain.com%{request_uri} [r=301,l,ne] 

Comments

Popular posts from this blog

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -