I just moved my subdomain multisite to a new server and I'm having some trouble with permalinks & redirects.

One difference post-move is that I have moved core WP files into it's own directory /wp (see roots/bedrock folder structure.

Now when I try to access /wp/wp-admin, I am redirected to /wp-login.php?redirect_to=... which comes up as a 404 of course because that file does not exist.

However, if I comment out the multisite constants in the config, I am able to access wp-admin as a non-multisite without issue (which is how I was able to make sure I have the right .htaccess below - from Tools > Network Setup).

I have .htaccess setup with the rules instructed by WP for multisite:

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

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) wp/$1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]

The other problem is that even with multisite off, I get a 404 when trying to go to any page other than the homepage.

I've read that multisite stores some path info in the DB, so perhaps a search/replace is necessary?

Update 1

I was able to resolve* the problem I had with the redirect to 404 when trying to access wp-admin. This was simply due to changes that needed to be made in the database for the siteurl. I was of the understanding that this value was superceeded by the WP_SITEURL constant. This does not seem to be the case with Multisite - probably because it has to be different for each site. Once I corrected the siteurl in the options table for each site, that site would work (wp-admin could be reached).

2 Problems remain

  1. Permalinks are still not working as they should. Now that I can access wp-admin, I have gone in, and resaved to update the permalink structure which seems to have no effect. By not working, I mean I get a 404 when navigating to anything away from the front page of that site.

  2. Network admin is inaccessible via the admin bar. The URL for Network admin it's giving me is missing the /wp directory. If I access it directly, /wp/wp-admin/network/ -- it works. For some reason, the generated URLs in the admin bar are missing this and are broken. If I change define('PATH_CURRENT_SITE', '/'); to define('PATH_CURRENT_SITE', '/wp/');, those URLs are correct, but trying to access them fails. That does not seem like the right thing to do in this case as one would expect that to be shown under /wp-admin/network/setup.php. After some digging, I found that these links are generated by network_admin_url(). Essentially the responsible line of code is set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme ); from network_site_url().

Update 2

I was able to resolve the permalink issue. As it turns out it was actually the virtual host configuration in apache! I had AllowOverride none set for my site's <Directory> directive, which I think was preventing any of the .htaccess rewrite rules from being applied. I should've realized earlier that this was the case as the 404 I was getting was from apache, not wordpress...

The only remaining weirdness at this point is the wrong url generated by network_admin_url(). Will post an answer if I figure this out.

  • Try this for the search, find and replace interconnectit.com/products/… Commented Jan 26, 2014 at 16:52
  • @BradDalton I just found that and that's what I've used so far. Great utility! Commented Jan 26, 2014 at 17:25
  • Try clearing the permalink option field in the database and resaving; I've seen that help with these symptoms in the past. As for the admin bar link, that function is still pulling the wrong URL from somewhere. Use phpmyadmin or adminer to search the whole database for URLs without the /wp/. Commented Jan 27, 2014 at 3:57
  • @songdogtech thanks for the suggestion. As it turns out, that issue was actually due to my botched vhost config in apache. I have done some more db searching and the only instances I have found seem to be legit (email addresses, options home, site domains). Commented Jan 27, 2014 at 22:44
  • @EvanMattson Has this question been resolved? Commented Sep 3, 2016 at 13:28

2 Answers 2


Well, the answer has several different ways..

==Method 1==

(when you want your website permalinks to become like example.com/wp/smth )

if so, just change this:

 RewriteBase /


 RewriteBase /wp

and in database, change all occurrences of example.com/ to example.com/wp/

==Method 2==

(when you want your website permalinks to remain example.com/smth )

Now you have A and B methods (As you say, you have made some changes to DB manually... revert them back and continue reading..). :
A) you should move all things from wp folder to public_html folder.
B) to use only .htaccess trick to solve the problem, and you can place all files into root>wp folder :

<IfModule mod_rewrite.c>
# move primary domain to subfolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ wp/index.php [L] 

just change example.com and put this htaccess into PUBLIC_HTML folder (so, wordpress .htaccess should be in wp folder)


All WP installs - single and MS - store URL data in the database, both for basic configurations and for paths to images and attachments in post/page content.

You may be able to get away with simply changing the one or two values in wp_options and then be able to get back into admin. If so, save/update permalinks to rewrite the rules in .htaccess.

But those two values can be different. WordPress Address (URL) is where WordPress resides, and for you, that will be /wp/ and not root. Site Address (URL) will be root, I assume, without the wp in the URL.

See http://codex.wordpress.org/Moving_WordPress and esp. http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

When you need to change URLs in the post/page content, use interconnectit.com WordPress Serialized PHP Search Replace Tool to correctly find/change URLs in the database and in serialized data.

If you use the interconnectit script, the issue with MS is that you will have different database table prefixes for subsites, so you need to look at the database with phpmyadmin or adminer to determine the prefixes for the number of subsites you have.

  • I've been looking through both of those codex pages. My site constants are as such: WP_HOME=http://mydomain.com WP_SITEURL=http://mydomain.com/wp. I've used the interconnectit utility to search and replace the necessary wp-content urls, but I don't think those could be giving me the problems I am experiencing. Also, the interconnectit utility does not seem to have any problem with my table prefixes if that's what you're referring to. It's probably worth mentioning too that the domain is the same, just the path to /wp and other filesystem paths. Commented Jan 26, 2014 at 17:35
  • Multisite has another level of site URLs in the wp_blog table.
    – AJ Zane
    Commented Dec 19, 2014 at 0: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.