Subdirectory still redirecting to www. despite rule

Ian M. Evans ianevans at digitalhit.com
Wed Sep 19 00:25:53 UTC 2012


This issue is connected to the threads

rewrite to www EXCEPT for one directory
(http://www.ruby-forum.com/topic/4405551) and

Nginx location rule for Wordpress Multisite in subdirectories
(http://www.ruby-forum.com/topic/4405180)

After making the changes to my nginx.conf. I reloaded the config. After
going to example.com/blogs/wp-admin/install.php the browser still
redirected to www.example.com/blogs/wp-admin/install.php

Here are the applicable lines in the conf:

server {
server_name example.com;
listen 80;

location / {
 return 301 http://www.example.com$request_uri;
      }

location ^~ /blogs {
  try_files $uri /blogs/index.php?q=$uri;
  location ~ \.php$ {
  fastcgi_pass 127.0.0.1:10004;
}
}
if ($uri ~ (/blogs/[^/]*)) {
  set $blogname $1;
}
location ^~ /blogs/$blogname {
  try_files $uri $blogname/index.php?q=$uri;
  location ~ \.php$ {
  fastcgi_pass 127.0.0.1:10004;
}
}
}

I'm wondering if it's an error in combining the config advice for the two
separate issues in the two threads.

Thanks.



More information about the nginx mailing list