Problem with multisite and subdomains

[ad_1]

Hello everyone,

I need help setting up the URLs of my client’s multisite WordPress installation.

They need this setup of URLs :

* the primary site is served on [www.multisite.domain.fr](http://www.multisite.domain.fr)
* two sites are served on [www.sitea.domain.fr](http://www.sitea.domain.fr) and [www.siteb.domain.fr](http://www.siteb.domain.fr)
* there is a page served on [domain.fr](http://domain.fr)

The links above all work, and are the site\_urls set up in the database and the wp\_config of the WP Multisite.

BUT, I also need the .com version of all those URLs to redirect to the .fr version.

Problem 1 : The non-www versions are not redirecting to the www version, but the non-www .com are redirecting to

So far, only the [domain.com](http://domain.com) & [www.domain.com](http://www.domain.com) > [www.domain.fr](http://www.domain.fr) and [domain.fr](http://domain.fr) > [www.domain.fr](http://www.domain.fr) work.

And [www.sitea.domain.com](http://www.sitea.domain.com) redirects to [www.sitea.domain.fr](http://www.sitea.domain.fr) and siteb too.

Any ideas ?

Thanks in advance.

BTW : here is my .htaccess

RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /
RewriteRule ^index\.php$ – [L]

# Add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L] RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L]

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect all .com domains to .fr
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)\.com$ [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST/2}.fr/$1 [L,R=301] [ad_2]

1 Comment
  1. It seems like your multisite setup is almost there! To fix the non-www redirection issue, try adding these lines to your .htaccess:

    “`
    RewriteCond %{HTTP_HOST} ^domain.fr$ [NC]
    RewriteRule ^(.*)$ https://www.domain.fr/$1 [L,R=301]
    “`

    Give it a try and let me know if it works!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer