Multisite Wordpress urls

My YunoHost server

Hardware: Raspberry Pi at home
YunoHost version: 4.8.0.3
I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen | …
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Can I redirect a the url of a principal site on a Multisite Wordpress to the subdomain where it is installed ?

I have installed a Wordpress multiste (before it was a single site, but removed before). I have installed it on a subdomain www.mydomain.tld.

As I seen it must be on a subpath, I have do so, the url of the multisite is something like www.mydomain.tld/blog.

Then, the first site created (principal site) has been created at first on another subpath, something like www.mydomain.tld/blog/blog.
I have change this url to keep the url of the first site like www.mydomain.tld/blog. Is it correct to do so or it could be a trouble ?

I can add new site on urls like www.mydomain.tld/blog/anotherblog.
I think it is not possible to do something like www.mydomain.tld/anotherblog. Do You confirm ?

Know I would like to know if I can redirect the adress www.mydomain.tld/blog to www.mydomain.tld. The url www.mydomain.tld at the moment point to the SSO.
Is it possible ?

I know there are some topics in this forum yet explaining how the urls match with a multisite on yunohost. But I would like to know if I can do that that and how.

In my registar OVH I have a CNAME pointing at www.mydomain.tld. Perhaps I don’t need it ? or I can change it ?

Few files if it helps

my wordpress/wp-config.php

define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/blog/';
define( 'DOMAIN_CURRENT_SITE', 'www.mydomain.tld' );
define( 'PATH_CURRENT_SITE', '/blog/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

/etc/nginx/conf.d/www.mydomain.tld.d/wordpress.conf

if (!-e $request_filename) {
	rewrite /wp-admin$ $scheme://$host$uri/ permanent;
	rewrite ^/blog(/[^/]+)?(/wp-.*) /blog$2 last;
	rewrite ^/blog(/[^/]+)?(/.*\.php)$ /blog$2 last;
}

 rewrite ^/blog$ /blog/ permanent;
location /blog/ {

       # Path to source
       alias /var/www/wordpress/;

       index index.php;
       if (!-e $request_filename)
       {
              rewrite ^(.+)$ /blog/index.php?q=$1 last;
       }

       # Force usage of https
       if ($scheme = http) {
             rewrite ^ https://$server_name$request_uri? permanent;
       }

       client_max_body_size 30m;
       location ~ [^/]\.php(/|$) {
           fastcgi_split_path_info ^(.+?\.php)(/.*)$;
           fastcgi_pass unix:/var/run/php/php7.3-fpm-wordpress.sock;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param REMOTE_USER $remote_user;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param SCRIPT_FILENAME $request_filename;
       }

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

Hope you can help me understand. Thanks

Mon serveur YunoHost

Hardware: Raspberry Pi à la maison
YunoHost version: 4.8.0.3
J’ai accès à mon serveur : En SSH | via le webadmin | accès direct via clavier/ écran | …
Êtes-vous dans un un contexte particulier ou avez fait des changements impotants sur votre instance YunoHost ? : non

Puis rediriger l’adresse du site principal d’un multisite Wordpress vers l’adresse du sous-domaine d’installation ?

Suite à une installation d’un Wordpress multiste (j’avais un simple site installé, supprimer avant). Je l’ai installé sur un sous-domaine www.mydomain.tld.

J’ai compris qu’il devait être installé avec un sous-chemin , ce que j’ai fait, l’url du multisite ressemble à www.mydomain.tld/blog.

Ensuite, le premier site créé (site principal) a été créé dans encore un autre sous-chemin, comme www.mydomain.tld/blog/blog.

J’ai changé cette url (via l’administration des sites) pour garder le premier site avec un chemin du genre www.mydomain.tld/blog. Est-ce que c’est gênant ?

Je peux rajouter un site avec une url comme www.mydomain.tld/blog/unautreblog.
Je crois que ce n’est pas possible de faire ainsi www.mydomain.tld/unautreblog. Me le confirmez-vous ?

Maintenant je voudrai savoir si je peux rediriger l’adresse www.mydomain.tld/blog vers www.mydomain.tld. L’url www.mydomain.tld pointe en ce momentvers le SSO.
Est-ce possible ?

Je sais qu’il existe plusieurs topics dans ce forum déjà expliquant comment les urls marchent avec un multisite sur yunohost. Mais j’aimerai savoir si c’est possible et comment ?

Sur mon registar OVH j’ai un CNAME qui pointe vers www.mydomain.tld. Peut-être est-il inutile ? ou à changer ?

Fichiers, si ça peut aider ?

Dans wordpress/wp-config.php

define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/blog/';
define( 'DOMAIN_CURRENT_SITE', 'www.mydomain.tld' );
define( 'PATH_CURRENT_SITE', '/blog/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

/etc/nginx/conf.d/www.mydomain.tld.d/wordpress.conf

if (!-e $request_filename) {
	rewrite /wp-admin$ $scheme://$host$uri/ permanent;
	rewrite ^/blog(/[^/]+)?(/wp-.*) /blog$2 last;
	rewrite ^/blog(/[^/]+)?(/.*\.php)$ /blog$2 last;
}

 rewrite ^/blog$ /blog/ permanent;
location /blog/ {

       # Path to source
       alias /var/www/wordpress/;

       index index.php;
       if (!-e $request_filename)
       {
              rewrite ^(.+)$ /blog/index.php?q=$1 last;
       }

       # Force usage of https
       if ($scheme = http) {
             rewrite ^ https://$server_name$request_uri? permanent;
       }

       client_max_body_size 30m;
       location ~ [^/]\.php(/|$) {
           fastcgi_split_path_info ^(.+?\.php)(/.*)$;
           fastcgi_pass unix:/var/run/php/php7.3-fpm-wordpress.sock;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param REMOTE_USER $remote_user;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param SCRIPT_FILENAME $request_filename;
       }

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

En attente d’une éventuelle aide à y voir plus clair. Merci

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.