
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 0.54 KB | hits: 12 | expires: Never
Nginx rewrite - only redirect to one domain
if ($request_uri ~ "s.domain.com"){
rewrite ^ http://domain-new.com;
}
server {
listen 80;
server_name s.domain.com;
rewrite ^ http://domain-new.com$request_uri? permanent;
}
server {
listen 80;
server_name s.domain.com;
# for index.xyz pages
location ~ ^/index..+$ {
rewrite ^ http://domain-new.com$request_uri? permanent;
}
# for pages with index left out
location / {
rewrite ^/$ http://domain-new.com permanent;
}
}