I am trying to force domain URL to use www always in WordPress Multisite.
For example if some one type abc.com then it should be redirect automatically to www.abc.com
I have used the following rules in htaccess but it works only for main domain in WordPress Multisite and not for other sub domains.
# Canonical https/www
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
So any help on this, is highly appreciated in advance.
Can you try this?
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [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.