[Rewrite] Url - rewriting
    CactO_o's 
    nginx-forum at nginx.us
       
    Thu Jul 30 21:23:52 MSD 2009
    
    
  
Hi all,
In first, i'm french and I don't speak english very well, so I hope you understand me =] 
So, I want redirect the Html page to index.php with GET argument, in this model :
http://www.domaine.tlm/.html => http://www.domaine.tlm/index.php?page=
I have do that  
server 
{
[...]
        location ~ .html$ {
                rewrite ^/(.*).html$ /index.php?page=$1;
        }
}
Another, I want rewrite the sub-domain if host ISN'T address IP :
http://.domaine.tlm/ => http://www.domaine.tlm/?sd=
For example,
- if  is html page :
http://.domaine.tlm/example.html => http://www.domaine.tlm/index.php?sd=&page=exemple
- if  is php script : 
http://.domaine.tlm/php/script.php?arg=get => http://www.domaine.tlm/php/script.php?sd=&arg=get
So I have write that  
server
{
        location / {
                root   /var/www/kreatoo;
                index  index.html index.htm index.php;
                if ( $host !~*  "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" )
                {
                         if ( $host ~* "(.*)\.*\.{2,4}" )
                         {
                                 set $sd $1;
                                rewrite ^(.*)$ http://www.domaine.tlm/index.php?sd=$sd
                         }
                }
        }
        [...]
}
But don't functionality !
Can you help me please ?
Thank you all !
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4619,4619#msg-4619
    
    
More information about the nginx
mailing list