I have website հttps://www. mysite.am
հttps://www. mysite.am
when I write in browser mysite.am, it works normally and open հttps://www.mysite .am
when I delete first www
. it opens հttps://mysite.am
and don't work properly. What write in .htaccess file to automated redirect all mysite.am domain to www.mysite.am
.
.htaccess :
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.mysite.am/ [L,R=301]
You must test https and www separately. Use:
RewriteCond %{HTTP_HOST} !^www\. [OR,NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.mysite.am%{REQUEST_URI} [NE,R=301,L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.