1 message in ru.sysoev.nginxRewriting all subdomains to one in pa...
FromSent OnAttachments
Saimon MooreJan 19, 2007 8:34 am 
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:Rewriting all subdomains to one in particular.Actions...
From:Saimon Moore (saim@public.gmane.org)
Date:Jan 19, 2007 8:34:15 am
List:ru.sysoev.nginx

Hi,

I have a nginx config with 4 virtual hosts.

Specifically I have the following server_name declarations in my virtual hosts:

#VH1 server_name es.mydomain.com;

#VH2 en.mydomain.com;

#VH3 fr.mydomain.com;

#VH4 mydomain.com *.mydomain.com;

What I'd like to do is rewrite any request for VH4 (i.e. not es/en/fr.mydomain.com) to :

www.mydomain.com

So if a request comes in for wwww.mydomain.com I'd like to rewrite it to www.mydomain.com/$request_filename

I've tried a few things but haven't managed to get it right.

My latest try:

#In VH4 server declaration location / { if ($host !~ "/^(www\.)?amicsmuseuprecolombi\.org/") { rewrite (.*) http://www.amicsmuseuprecolombi.org$1 permanent; } }

Thanks,

Saimon