Forums

Adding a 'www' to DOMAIN_CURRENT_SITE (6 posts)

  1. pealo86
    Member
    Posted 1 year ago #

    I am trying to change my WP multisite from:

    http://domain.co.uk to http://www.domain.co.uk

    ...but with no luck.

    I have tried a simple search & replace on the db to replace all instances of http://domain.co.uk with http://www.domain.co.uk as well as updating my wp-config.php file with the following:

    define( 'DOMAIN_CURRENT_SITE', 'www.domain.co.uk' );

    Everything appears to work fine, however it means that I can no longer access my Network Admin page. When clicking the link it attempts to load for about 10 seconds before Firefox then gives me an error to say that the page isn't redirecting properly, although I can't figure out where it's trying to redirect to.

    I did add the following to my wp-config.php file to fix a different issue:
    define('NOBLOGREDIRECT', 'http://www.domain.co.uk');

    And I have tried it both with and without this line of code, neither appears to work.

    If I reverse the search & replace on the db and restore my wp-config.php file then the site works fine again, but without the 'www' in the address bar.

    Does anyone know if I am missing something? I'm getting very frustrated trying to figure out what the problem is an am actually considering just starting with a fresh install of WordPress and copying over the necessary posts from the old database, although that could get a little messy.

  2. Tim Moore
    Code Wrangler
    Posted 1 year ago #

    Is there a reason you need www. in the URL? You can set up a .htaccess rule to redirect any URL with www. to its non-www. counterpart. That is usually the easiest and most reliable fix.

  3. I have tried a simple search & replace on the db to replace all instances of http://domain.co.uk with http://www.domain.co.uk

    Check the wp_sites table - It should have your site listed as doamin.co.uk (note the lack of http).

  4. pealo86
    Member
    Posted 1 year ago #

    Is there a reason you need www. in the URL? You can set up a .htaccess rule to redirect any URL with www. to its non-www. counterpart. That is usually the easiest and most reliable fix.

    My client's request ;) Thanks for the tip!

    Check the wp_sites table - It should have your site listed as doamin.co.uk (note the lack of http).

    Ohhh right, that should be without "http://www" regardless of whether I want a 'www' in the url or not?

  5. If you want the www to show up in your address, both the wp-config and the wp_sites have to have the www. domain.co.uk (extra space put in to stop the forums from auto correcting) WITHOUT the http:// in front.

  6. pealo86
    Member
    Posted 1 year ago #

    Ohhh I see. Thanks, will give that a try

Topic Closed

This topic has been closed to new replies.

About this Topic