nginx rewrite question

Igor Sysoev is at rambler-co.ru
Thu Jul 9 12:40:29 MSD 2009


On Thu, Jul 09, 2009 at 10:35:45AM +0200, Juergen Gotteswinter wrote:

> Hello,
> 
> perhaps someone here could help me with the following problem. i got a 
> domain justfornow.com which got a wildcard dns entry, and i need to 
> redirect this domain to https. but i have to keep the first part of the 
> domain, for example:
> 
> user calls http://try.justfornow.com nginx rewrites it to 
> https://try.justfornow.com
> user calls http://anything.justfornow.com nginx keeps the first part and 
> rewrites it to https://anything.justfornow.com

server {
    listen       80;
    server_name  *.justfornow.com;
    rewrite      ^    https://$host$request_uri?  permanent;
}


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list