Redirect Mobile Users to

yaronycity nginx-forum at
Mon Aug 6 21:22:44 UTC 2012

Hi all, 

I have a wordpress website I have created a mobile
version of it and put in "m" folder of that domain. I want all my mobile
users to be redirected to where
will be using a mobile version of the website located in "m" folder. By
using the below rewrite rules, it does redirect to
but it does not display any website from the "m" folder. ( Please help:

server {
  access_log /home/nginx/domains/ combined
  error_log /home/nginx/domains/;
  root /home/nginx/domains/;

  try_files $uri $uri/ /index.php;
  location / {
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$args;
	location ^~ /m/index.html {
    rewrite ^/m/(.*)$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;

 Please help

Posted at Nginx Forum:,229364,229364#msg-229364

More information about the nginx mailing list