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'm having an issue that I can't find anybody else talking about anywhere. I have a wordpress multisite setup utilizing sub-directories. It's running on Debian Squeeze, and it's powered by nginx, php 5.4, and php5-fpm.

Currently I am using the batcache plugin and the advanced apc caching plugin from mark jaquith.

The Bad: So, the problem I'm having is that when I access the site with either IE, Chrome or by mobile, it always redirects back to the root site. The only time it doesn't is when accessing wp-admin.

The Good: The whole setup works perfect on firefox. I have ran some curl -I passes on the site to get the header info. Here are the results: http://pastebin.com/VryGXAAY

What I've Tried: I have cleared the browser cache. Tried it on a different machine. And yelled at it a lot.

Here is a copy of the config files:

sites-enabled/example.com: http://pastebin.com/69xsMuwb

globals/mu-dir.conf: http://pastebin.com/CSup1q1h

globals/mu-files.conf:

# Rules for any Multisite install
# For uploads
if ( $uri ~ "files" ) {
    rewrite ^/(?:.*/)?files/(.+) /wp-includes/ms-files.php?file=$1;
}

globals/restrictions.conf: http://pastebin.com/rhrr5Qkf

globals/common-locations.conf: http://pastebin.com/GiYBRP1y

Let me know what other info you might need. Any help would be appreciated! :)

share|improve this question
    
Also, I got most of my setup for nginx from @Pothi Kalimuthu over at: github.com/pothi/WordPress-Nginx Not sure if that will help or not... –  Michael Chase Mar 15 '13 at 9:49
1  
Why do you assume there is a problem with nginx configuration? The fact that firefox works well suggest otherwise. –  Mark Kaplun Mar 15 '13 at 10:13
    
@MichaelChase I could not reproduce the 301 redirect on Google Chrome browser. I have a demo MU (sub-directory) setup at elegantblogs.net and elegantblogs.net/blog1 . Could you please check, if that works on your end? –  Pothi Mar 15 '13 at 12:49
    
Thanks for the replies. @ MarkKaplun I assume it's an nginx problem because that's the only thing that affects the redirection... or so I thought? @PothiKalimuthu That site works perfectly on all of the browsers. Did you set that up using the same config that I posted? If so, what else could be the issue with my site? Thanks again for your help guys –  Michael Chase Mar 15 '13 at 22:30
1  
@MichaelChase I tried your configuration and mine mentioned in the github along with batcache and APC object cache backend. I still could not reproduce the 301 redirect in Google Chrome for a multisite subdirectory install. I honestly think the issue is not within nginx configuration, since it works as expected as per your curl -I output. You could check the access and/or error log when you access your site using Chrome, IE or mobile. That should provide you more clarity on how things work. Additionally, you may shut down PHP, APC or batcache to see, if it is specific to Nginx, php or WP. –  Pothi Mar 16 '13 at 2:03

1 Answer 1

up vote 0 down vote accepted

Alright I figured it out. Thank you guys. What it came down to was a little snippet of code I put in a while back to redirect a user to the home page if not logged in.... stupid me.

I really appreciate your help in this though. By disabling everything but wordpress (all plugins, caching, everything.) it still happened. I decided to change the theme used on my root site to the same theme used on the sub-sites and it resulted in an endless redirect. boom. That's when the light turned on.

Thanks again! -Chase

And if anybody wants that code, here it is: it word pretty well! :)

<?php if (
  !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))
  && !is_admin()
  && !is_user_logged_in()
) {
  wp_redirect('http://www.example.com/', 301);
  exit;
}
?>
share|improve this answer

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.