Jump to content

Wordpress Multisite: Adding / Removing 'www' in site location


pealo86

Recommended Posts

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.

 

Link to comment
Share on other sites

Your Wordpress installation should have a .htaccess file in the root. Please connect through FTP and download the file. Usually FTP clients will not list the file starting with a dot(.). Please find out how to list the hidden file in your FTP client. Then you should see this file in the list. Open it with "Notepad" or in any simple text editor (NOT IN MS-WORD) and add the following line after the line "RewriteEngine On":

 

# redirect non-www to www
RewriteCond %{HTTP_HOST} ^domain\.co\.uk
RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=301,L]

 

Save and reupload the file back to the location from where you have download it. Please take a backup of the previous .htaccess file before downloading. Just in case. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.