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 :
[b]http://www.domaine.tlm/[x].html[/b] => [b]http://www.domaine.tlm/index.php?page=[x][/b]
I have do that [/etc/nginx/site-available/default]
[code]
server
{
[...]
location ~ .html$ {
rewrite ^/(.*).html$ /index.php?page=$1;
}
}
[/code]
Another, I want rewrite the sub-domain if host ISN'T address IP :
[b]http://[x1].domaine.tlm/[x2][/b] => [b]http://www.domaine.tlm/[x2]?sd=[x1][/b]
For example,
- if [x2] is html page :
[b]http://[x1].domaine.tlm/example.html[/b] => [b]http://www.domaine.tlm/index.php?sd=[x1]&page=exemple[/b]
- if [x2] is php script :
[b]http://[x1].domaine.tlm/php/script.php?arg=get[/b] => [b]http://www.domaine.tlm/php/script.php?sd=[x1]&arg=get[/b]
So I have write that [/etc/nginx/site-available/default]
[code]
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 ~* "(.*)\.[a-zA-Z0-9_-]*\.[a-zA-Z]{2,4}" )
{
set $sd $1;
rewrite ^(.*)$ http://www.domaine.tlm/index.php?sd=$sd
}
}
}
[...]
}
[/code]
But don't functionality !
Can you help me please ?
Thank you all !