Rewrite for subdomain

I want to set a rewrite rule for redirection of search.php?q=word to
word.domain.com
I used the following rule but did not work.

rewrite ^(.*).$server_name /search.php?q=$1 permanent;

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220917,220917#msg-220917

On 7 Jan 2012 19h11 WET, [email protected] wrote:

I want to set a rewrite rule for redirection of search.php?q=word to
word.domain.com
I used the following rule but did not work.

Try:

location ^~ /search.php {
return 301 http://$arg_q.domain.com;
}

— appa

On Sun, Jan 8, 2012 at 5:51 AM, António P. P. Almeida [email protected]
wrote:

}

and the reverse:

server {
listen 80;
server_name ~^(?.+).domain.com$;
rewrite ^ http://domain.com/search.php?q=$keyword permanent;
}


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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs