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

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -