dns - Nginx server_name isn't applying to rewrite subdirectories. -


i'm trying use nginx redirect main page (www.domain.com) subdirectory (www.domain.com/store). have redirect working, whenever use domain name redirect me ip address (www.ip.com/store). server nginx config. thank in advance help!

    server {     listen       80 default_server;     server_name *.domain.com;      location  / {         index  index.php index.html index.htm;     }     location = / {         rewrite ^/store permanent;     }      root   /usr/local/www/nginx; 

}

you missed space. rewrite ^/store permanent; try match '/store' @ beginning of uri path (thanks ^) , if matches, rewrite 'permanent'. since inside location = /, never succeed. instead, need:

rewrite ^ /store permanent; 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -