Redirect Mobile Users to m.domain.com

yaronycity nginx-forum at nginx.us
Mon Aug 6 21:45:43 UTC 2012


I have changed it this, and it still does not work:(

server {
  server_name domain.com www.domain.com;
  root /home/nginx/domains/domain.com/public;
  
  server_name m.domain.com www.m.domain.com;
  root /home/nginx/domains/domain.com/public/m;

  try_files $uri $uri/ /index.php;
  
  location / {
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$args;
    }
	
	location ^~ /m/ {
    rewrite ^/m/(.*) http://m.domain.com/$1 permanent;
}
	
	
  # Directives to send expires headers and turn off 404 error logging.
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires 24h;
            log_not_found off;
    }

  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
  
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,229364,229367#msg-229367



More information about the nginx mailing list