How to generate url with sub domain to new url with query string?

Edho P Arief edhoprima at gmail.com
Mon Jun 22 16:52:04 MSD 2009


On Mon, Jun 22, 2009 at 12:37 PM, leakhina<nginx-forum at nginx.us> wrote:
> Hi everyone,
>
> I'm very new with Nginx, and now I want to use Nginx to generate new url from the url user passed.
> Example:
> User type to browser like http://us.domain.com, and I want Nginx generates to http://www.domain.com/?portal=us or http://domain.com/?portal=us.
>
> How can I rewrite the nginx to do this?
>
> Best regards,
> Leakhina
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3235,3235#msg-3235
>
>
>

maybe something like this

server {
  listen 80;
  server_name ~(.*)\.domain\.com;
  set $loc $1;
  rewrite ^.* http://domain.com$request_uri?portal=$loc;
}

-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org





More information about the nginx mailing list