Welcome! Log In Create A New Profile

Advanced

[Rewrite] Url - rewriting

July 30, 2009 12:22PM
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 !
Subject Author Posted

[Rewrite] Url - rewriting

CactO_o's July 30, 2009 12:22PM

Re: [Rewrite] Url - rewriting

CactO_o's July 30, 2009 02:03PM

Re: [Rewrite] Url - rewriting

CactO_o's July 30, 2009 02:03PM

Re: [Rewrite] Url - rewriting

Igor Sysoev July 30, 2009 02:23PM

Re: [Rewrite] Url - rewriting

CactO_o's July 30, 2009 05:07PM

Re: [Rewrite] Url - rewriting

Igor Sysoev July 31, 2009 05:26AM

Re: [Rewrite] Url - rewriting

Andrius Semionovas July 30, 2009 02:28PM

Re: [Rewrite] Url - rewriting

CactO_o's August 01, 2009 06:53AM

Re: [Rewrite] Url - rewriting

CactO_o's August 05, 2009 01:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 57
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready