Home > other >  Multisite mapped domain force to use www
Multisite mapped domain force to use www

Time:12-16

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.

CodePudding user response:

Can you try this ?

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
  • Related