Search code examples
phpwordpress.htaccessredirect-loopmultisite

Moving Wordpress multisite to localhost in subfolder


I recently mowed my website from www to localhost in a sub-folder so the site url looks like this : http://localhost/mysite/main

This is a WordPress mulsitite. Ive searchred and replaced db www.mysite.com -> localhost/mysite/main

There is my .htaccess

RewriteEngine On

RewriteBase /mysite/main/
RewriteRule ^index\.php$ - [L]
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]

in wp-config.php added the following

define('WP_DEBUG', false);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost/mysite/main');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

For some reason though I'm getting a webpage redirect loop.

No idea why!?

Thanks for you help in advance.


Solution

  • I think this is a www / non-www version of your site problem. Make sure you have used exactly localhost/mysite/main in your database and haven't missed anything in there.

    Also, manually review all the wp_x_options tables and look for three fields and edit them as needed:

    home siteurl fileupload_url If you are moving from subdomains to subfolders, or vice-versa, remember to adjust the .htaccess file and the value for SUBDOMAIN_INSTALL in your wp-config.php file accordingly. reference