0

Below, I'm calling the development site mainsite.com (containing the WPMS install) and the domain that will point to a Norwegian sub-site of mainsite.com, I call launchsite.no.

A Norwegian sub-site is ready to be launched, and the client is ready to point launchsite.no to the Wordpress installation. I'm manually pointing launchsite.no to the correct IP address in HOSTS to make sure it's ready for the 'switch'.

So it's not a migration question. The host has internally made an alias for launchsite.no to be the same directory where the WPMS install is.

  • The site works perfectly when Domain is set to mainsite.com and Path is set to /no/ (in wp-admin).

  • Just pointing launchsite.no to the server IP gives me mainsite.com (main site, not Norwegian). (And launchsite.no/wp-admin doesn't work.)

  • I changed the Domain to launchsite.no and the Path to / for the Norwegian site.

  • This gives me launchsite.no (yay!) and if I hover on all links on the site, they are correct, like launchsite.com/om-oss (About Us page). But when I click them, all of them give 302 Moved Temporarily and I end up on mainsite.com!

I'm having trouble debugging this. I have read these documents and these from the codex

The Site URL and Home in the database are correct, and there are no relevant occurrences of mainsite.com/no/.

I've tested out some URLs that work and some that don't, hoping that it will give a clue.

  • launchsite.no/wp-admin/ - OK (phew!)

  • launchsite.no/ - OK, Norwegian start page.

  • launchsite.no/om-oss (page) - 302 redirect to mainsite.com!

  • launchsite.no/?pagename=om-oss (same page) - OK!

  • launchsite.no/?page_id=18 (same page) - 302 redirect to mainsite.com.

I have disabled the Rewrite and Yoast SEO plugins (since they are capable of doing 301 redirects), no difference.

I have saved and flushed Wordpress' rewrite rules.

The host will not help me with Wordpress, but just says WP Multisite works on their servers. So I would be very grateful for suggestions what causes this, where I should look.

It seems that Wordpress' own permalink translation is broken after the "sub-site move".

UPDATE:

I think I've ruled out everything but an error in wp_rewrite. Is there a way to catch or log what Wordpress is rewriting the page Permalinks to? Is there a third value apart from siteroot and home that it uses, that I could check in the database?

Here is my .htaccess (standard, from the multisite article on wordpress.com):

Options All -Indexes
DirectoryIndex index.php index.html index.htm

#make sure in development site is not found by search engines.
Header set X-Robots-Tag "noindex, nofollow"

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymlinks
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]

# END WordPress

And here's my wp-config:

$table_prefix = 'wp_';

/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
define('WPLANG', '');

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'mainsite.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('WP_POST_REVISIONS', true);
define( 'WP_AUTO_UPDATE_CORE', false );

/* 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');

1 Answer 1

2

Your wp-config.php indicates that you've set up a subdirectory installation, but you want to be able to use different domain names for the sites. To do that, I believe you'll need a plugin of some sort.

A quick search indicates that WordPress MU Domain Mapping may do what you need. Be sure to read the installation instructions carefully -- it looks somewhat more involved than the usual "put the plugin in wp-content/plugins and activate".

Caveat: I have a fair amount of experience in WordPress Multisite subdirectory installations, but my WPMS subdomain knowledge is pretty thin. If I've made an error, please correct me.

1
  • Yes, I did this a day before your answer. This was the solution. I just kept the subfolder mapping and the plugin mapped up the domains beautifully, and even let me set priority for www/no www. I did look at this before that actually, but the WPMU in title and description turned me away. Perfect plugin, easy to install and use. Commented May 30, 2014 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.