[Nginx Config] rewrite host

shaktale nginx-forum at nginx.us
Tue Aug 25 18:21:45 MSD 2009


> For example :
> if( $host ~* "(.*)\.*\.{2,4}" )
> {
>     addGet sd $1;
> }
> 
> This code add "?sd=$1" or "&sd=$1" (if there are already arguments GET before or not)
> 
> If not exist how can I do for write this function (or code who make the same ?)
> 
> Thank you and sorry for my english (I'm french :p)

Hello.

If I understand correctly, you need something like this:


server {
  listen 80;
  server_name ~(.*)\..*\..*;
  rewrite ^ /$request_uri&$1;
}


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






More information about the nginx mailing list