Welcome! Log In Create A New Profile

Advanced

Re: Regex for rewrite of subdomains

All files from this thread

File Name File Size   Posted by Date  
smime.p7s 6 KB open | download GreenGecko 02/14/2013 Read message
Darren Pilgrim
February 15, 2013 12:50AM
On 2013-02-14 14:05, etrader wrote:
> I want to rewrite subdomains by adding a separate server for subdomains as
[...]
> keyword.domain.com/query=some to
> domain.com/script.php?query=some&sub=keyword

server {
server_name *.domain.com;

if ($http_host ~* (.+)\.domain.com$) {
set $keyword $1;
}

if ($request_uri ~* ^/query=(.+)) {
return 301 http://domain.com/script.php?query=$1&sub=$keyword;
}
}

I'm not sure a map would be faster in this case because you don't need a
multitude of patterns.

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

Regex for rewrite of subdomains

etrader February 14, 2013 05:05PM

Re: Regex for rewrite of subdomains Attachments

GreenGecko February 14, 2013 05:52PM

Re: Regex for rewrite of subdomains

Darren Pilgrim February 15, 2013 12:50AM

Re: Regex for rewrite of subdomains

Igor Sysoev February 15, 2013 01:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 321
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