Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Try this for the search, find and replace interconnectit.com/products/… –  Brad Dalton Jan 26 at 16:52
    
@BradDalton I just found that and that's what I've used so far. Great utility! –  Evan Mattson Jan 26 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/. –  songdogtech Jan 27 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). –  Evan Mattson Jan 27 at 22:44

1 Answer 1

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.

share|improve this answer
    
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. –  Evan Mattson Jan 26 at 17:35
    
Multisite has another level of site URLs in the wp_blog table. –  AJ Zane Dec 19 at 0:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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