• Resolved huskydog

    (@huskydog)


    I have had a single site installation working OK for several years and am trying to convert to multisite with subdomains.

    I have followed the numerous instruction but whenever I add the define(‘MULTISITE’, true); entry to wp-config.php my site breaks badly. Basically, all the internal links which should be of the form site.huskydog.org.uk/sample-page change to hostname/wordpress/sample-page. Hostname is indeed the hostname of the server.

    I presume that the .htaccess re-write process isn’t working properly, but I entered it exactly as specified by wordpress when I switched on multisite and I know it is being parsed by Apache as if I break it I get an error.

    Reference details:
    Wordpress: 5.2.3
    Apace: 2.4.41
    PHP 7.3.13
    Puro Theme
    I operate my own local Gentoo Linux server so I have full root access.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Okay, I feel I’ve been sent on a wild goose chase…

    When I try to go to your site as listed above I get a 404 error. I trimmed that and got a hampster site with a different domain name.

    Just for hee haws I tried HuskyDog.com and got a construction website for somebody in Canada Nunavut? which was starting to make some sense.

    I then somehow wound up at https://huskydog.com/Huskydog.com/WELCOME.html

    None of the sites I visited are WordPress sites except the hampster site! And the hampster lives in England!

    https://www.ads-software.com/support/topic/mapping-domain-on-the-same-ip-address-same-hosting/#post-12310641
    Copy and paste this url in your browser, essentially before creating a network you are using a single installation of WordPress and therefore after the transformation into a Multisite the primary site (the single WordPress site) will have the blog suffix example https://example.com/blog/sample-page.
    If you use the same domain you don’t have to have big differences.
    To offer help I need to know the initial and final domain, thank you.

    Thread Starter huskydog

    (@huskydog)

    Hello and thank you both for replying.

    JNashHawkins
    Yes, my site is the hamster one. I was just trying to express the problem in the abstract so didn’t bother with the real site URL. I have switched it back to single site mode now as I don’t want to leave it in the broken state. I have no idea how secure it is when broken and since you have to disable plugins I don’t have iThemes security active when it is broken and that makes me nervous.

    autotutorial
    Thanks for offering to help but I didn’t quite understand what the linked article was trying to say. Let me try to be a bit clearer about what I have done and what is happening.

    For several years I have had a fully functional blog at funfoodfreedom.huskydog.org.uk. I now want to create a new blog for a local club. For testing purposes it will be at sarumfinescale.huskydog.org.uk although I may move it to its own domain once it is working. I have created the DNS entry for the second blog.

    What I did:
    1) I added define(‘WP_ALLOW_MULTISITE’, true); to the end of my wp-config.php file and disabled all of my plugins.
    2) As described I then had a networking option under tools so I selected “sub-domains”, gave my network a suitable title and clicked “install”.
    3) A page appeared explaining edits I had to make to wp-config.php and .htaccess. I made these and the files now look as below:

    <?php
    //The entry below were created by iThemes Security to disable the file editor
    define( ‘DISALLOW_FILE_EDIT’, true );

    define(‘WP_HOME’,’https://funfoodfreedom.huskydog.org.uk&#8217;);
    define(‘WP_SITEURL’,’https://funfoodfreedom.huskydog.org.uk&#8217;);

    <** Lots of lines with passwords and suchlike which I haven’t touched **>

    define(‘WP_DEBUG’, false);
    /*define(‘WP_DEBUG_LOG’, true);*/

    define(‘MULTISITE’, true);
    define(‘SUBDOMAIN_INSTALL’, true);
    define(‘DOMAIN_CURRENT_SITE’, ‘funfoodfreedom.huskydog.org.uk’);
    define(‘PATH_CURRENT_SITE’, ‘/’);
    define(‘SITE_ID_CURRENT_SITE’, 1);
    define(‘BLOG_ID_CURRENT_SITE’, 1);

    /* That’s all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */
    if ( !defined(‘ABSPATH’) )
    define(‘ABSPATH’, dirname(__FILE__) . ‘/’);

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . ‘wp-settings.php’);

    /* Multisite */
    define(‘WP_ALLOW_MULTISITE’, true);

    My .htaccess file looks like this.

    php_value upload_max_filesize 32M
    php_value post_max_size 128M
    php_value memory_limit 256M

    # BEGIN WordPress
    # The directives (lines) between BEGIN WordPress and END WordPress are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    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]
    </IfModule>

    # END WordPress

    So, what happened?

    According to the instructions I should now log back in and add my new site via the “My Sites” menu. Unfortunately, I can’t log in or indeed do anything else at all. All I see if the front page of my original blog but without any theme or images. The links are there but don’t work because they point to the wrong place.

    So, for example, when my single site is working, the “Log In” link points to:
    https://funfoodfreedom.huskydog.org.uk/wp-login.php?itsec-hb-token=funlogin&#8221; but on the new broken site it points to:
    “garry/wordpress/wp-login.php” Note: The new links don’t have any “https://&#8221; at the start.

    garry is the hostname of the host for the virtual machine running WordPress. To be clear, I have a server called garry hosting a virtual machine called alex on which is running Apache with my WordPress installation. I host my blog like this to increase security and it has worked fine in single site mode for years. The complete mystery (now I come to think about it) is how exactly the WordPress installation on the virtual machine knows of the hostname ‘garry’ in the first place. So far as I know, the only place in my WordPress configuration where ‘garry’ is mentioned is as the MySQL server.

    make sure to enclose the strings with single quotes or double quote, also please when writing code press the code code thank you.

    $var = 'single quote';
    $var2 = "double quote";
    Thread Starter huskydog

    (@huskydog)

    Hello – I am pleased to say that I have solved the problem.

    The issue relates to the two lines in wp-config.php which read:

    define(‘WP_HOME’,’https://funfoodfreedom.huskydog.org');
    define(‘WP_SITEURL’,’https://funfoodfreedom.huskydog.org');

    When I looked in the database I discovered that ‘home’ and ‘siteurl’ were both set to ‘http:gordon/wordpress:80’. This setting must have been set very early on when I first installed WordPress. It was having no effect during single site as the two lines above were overriding it. The funfoodfreedom address was also the one which showed up in the site configuration page and as I said the site worked fine from this URL for years.

    Clearly, when I tried to activate multisite it read the values from the database rather than wp-config.php and set the links incorrectly. I corrected the database entries using the functions.php technique listed in the article below and now things seem to all be working correctly and I have added a new site.

    https://www.ads-software.com/support/article/changing-the-site-url/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Server hostname instead of site url in multisite’ is closed to new replies.