4 messages in ru.sysoev.nginxRe: redirecting non www to www.
FromSent OnAttachments
iane...@public.gmane.orgJan 14, 2007 3:11 pm 
Jonathan DanceJan 14, 2007 5:53 pm 
iane...@public.gmane.orgJan 14, 2007 6:26 pm 
Igor SysoevJan 14, 2007 9:27 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: redirecting non www to www.Actions...
From:Jonathan Dance (jd-a@public.gmane.org)
Date:Jan 14, 2007 5:53:22 pm
List:ru.sysoev.nginx

You would use a separate server directive for this:

server { server_name example.com; listen 80; location / { rewrite ^(.*) http://www.example.com$1 permanent; } }

Cheers, JD

On 1/14/07, ianevans-H/XkN3sKs41m/Kok3h1/6Q@public.gmane.org
<ianevans-H/XkN3sKs41m/Kok3h1/6Q@public.gmane.org> wrote:

Just trying to clean things up for Google's duplicate issues...this might be a basic example to toss in the rewrite module part of the wiki for people who suck at regex's like me. <g>

So a) who would you redirect a example.com request to www.example.com and b) where would it go in the order of the locations:

location / { ... }

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|mov)$ { ... }

Thanks.