Rewrite for subdomain
Edho Arief
edho at myconan.net
Sat Jan 7 23:00:33 UTC 2012
On Sun, Jan 8, 2012 at 5:51 AM, António P. P. Almeida <appa at perusio.net> wrote:
> On 7 Jan 2012 19h11 WET, nginx-forum at nginx.us 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;
> }
>
and the reverse:
server {
listen 80;
server_name ~^(?<keyword>.+)\.domain\.com$;
rewrite ^ http://domain.com/search.php?q=$keyword permanent;
}
--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the nginx
mailing list