0

I have to move a WordPress multisite from one server to another. I duplicated all my files and the db and now I would like to test it by browsing a few of the installed blogs. Unfortunately I can't access them because the URL rewrite rules in my .htaccess redirect me to the root URL.

For example, say the hostname of the WP multisite is example.com and one of the install blog's URL is example.com/installedblog/. On the new server, I haven't set up my DNS, yet and I can only access my site using the IP address and username, like this: 127.0.0.1/~username/. This URL works, but if try 127.0.0.1/~username/installedblog/ or 127.0.0.1/~username/wp-admin, I get redirected to the Apache 404 page.

My .htaccess is the default one for Wordpress MU, which works on the server with DNS set up:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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]

I've also tried changing RewriteBase to /~username/ and it didn't work, either.

I'm thinking the problem is that the Site URL of I my WordPress is example.com/, not 127.0.0.1/~username/, so if I want to test it on the new server I would have to change it to 127.0.0.1/~username/ and than back to example.com, which is an unnecessary hassle.

Since I can't delete my post, please close it, because I seem to have answered my own question.

1 Answer 1

1

Don't change the .htaccess, just change your wp-config.php with your new DNS (name or IP address).

Try to modify these variables:

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', '127.0.0.1/~username/installedblog/' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
2
  • Thanks for your help. I can now access WP on my new server without being redirected to the old domain. Doing so, I realized that I was actually being redirected to 127.0.01/wp-admin and shown the Apache 404 page (and not being redirected to 127.0.0.1/~username/). However, I definitely say Apache's rewrite module installed and active in WHM... Can you think of another reason why I might be being server the 404 error document?
    – bogdan
    Jan 7, 2012 at 8:31
  • try to change this variable: define( 'PATH_CURRENT_SITE', '/' ); in define( 'PATH_CURRENT_SITE', '/~username/' ); In any case, the you can solve all redirect problem with the config file :) Jan 11, 2012 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .