WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress Multisite Network Admin URL (4 posts)

  1. sajeconsultants
    Member
    Posted 1 year ago #

    We are running a client's website which is set up in such a way that it does not allow its URLs to run correctly without www in the front.

    It seems that when you log into WordPress Admin, the Network Admin links all have non-www links by default. Is there a way to change this permanently?

    We've gone and updated .htacess to force a 301 redirect to the www version of the site a such:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

    This corrects the Network Admin links and they work fine, but it seems doing any specific actions within do NOT work. For example, trying to add a new user to the system causes a failure. In taking a look at the source code, I noticed that the Add User form (ex: http://www.domain.com/wp-admin/network/user-new.php) uses the following code:

    <form action="http://domain.com/wp-admin/network/user-new.php?action=add-user" id="adduser" method="post">

    Where I can force WordPress to render this code so that it uses www in front of the URL for the form action?

  2. It seems that when you log into WordPress Admin, the Network Admin links all have non-www links by default.

    Usually that only happens if you had some weird miss-match of your domains.

    Do a search on your whole DB for http://domain.com and change it.

  3. sajeconsultants
    Member
    Posted 1 year ago #

    I've actually tried this and found 0 instances of http://domain.com across all database tables.

    Within wp-config.php, we currently have this line:
    define('DOMAIN_CURRENT_SITE', 'domain.com');

    Should this be changed to?:
    define('DOMAIN_CURRENT_SITE', 'www.domain.com');

    Or alternatively, within the database on the wp_blogs and wp_site tables, the domain column is currently set to 'domain.com'. Should this be changed across the board to 'www.domain.com'?

  4. sajeconsultants
    Member
    Posted 1 year ago #

    So I was able to get this resolved. For anyone in the future who might have the same issue, this is what I did:

    1 - Update wp-config.php to use www in the DOMAIN_CURRENT_SITE:
    define('DOMAIN_CURRENT_SITE', 'www.domain.com');

    2 - On the wp_blogs table, update domain column for MAIN site to use http://www.domain.com

    After those two changes, everything in Network Admin seems to be working correctly now!

Topic Closed

This topic has been closed to new replies.

About this Topic