Welcome! Log In Create A New Profile

Advanced

Re: Rewrite for subdomain

Edho Arief
January 07, 2012 06:02PM
On Sun, Jan 8, 2012 at 5:51 AM, António P. P. Almeida <appa@perusio.net> wrote:
> On 7 Jan 2012 19h11 WET, nginx-forum@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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite for subdomain

etrader January 07, 2012 02:11PM

Re: Rewrite for subdomain

António P. P. Almeida January 07, 2012 05:52PM

Re: Rewrite for subdomain

Edho Arief January 07, 2012 06:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready