WordPress deleting subdomain from the URL

Do you use Multisite mode for WP?
If not, the mechanism for enabling Multisite mode is shown below:

Edit wp-config.php and enable the option :

define( 'WP_ALLOW_MULTISITE', true );

Next, in the control panel, find the network Setup tab in the Tools section. Select the address format for the network.
Update your files wp-config.php:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'new-multisite-setup.dev');
define('PATH_CURRENT_SITE', "https://wordpress.stackexchange.com/");
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

and .htaccess :

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

In your control panel you will find a new option in the admin navigation menu called Sites. Go to the Sites tab and add your subdomain by filling in all the fields. After that, the problem with the transition should stop.