Nginx rewrite help

Hi,

I have a forum site, (with multi-forum)

this is working:
http://destek.10tl.net/forumdisplay.php?fid=40

but this is not working:
http://destek.10tl.net/Forum-40.html

my nginx conf related part is:

    location / {
        rewrite ^/mybb/((?i)Forum-([^./]+))$

/mybb/forumdisplay.php?google_seo_forum=$2;
if ($host !~* server2.10tl.net) {
rewrite (.*) /mybb/$1 break;
}

    }

    location ~ \.php$ {
                    set $test "";

                    # server2.10tl.net haric,
                    if ($host !~* server2\.10tl\.net) {
                            set $test  "${test}yaz";
                    }

                    # daha once mybb eklendiyse yukarda, bidaha

rewrite yapma.
# I am using nginx logical and-ing technique
as described in nginx site.

                    if ($request_filename !~* mybb) {
                            set $test  "${test}yaz";
                    }

                    if ($test = "yazyaz" ){
                            rewrite     (.*) /mybb/$1 break;
                    }

       fastcgi_pass   127.0.0.1:9000;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME 

$document_root$fastcgi_script_name;
include fastcgi_params;
}

I expect this part:
rewrite ^/mybb/((?i)Forum-([^./]+))$
/mybb/forumdisplay.php?google_seo_forum=$2;

to translate Forum-40.html to forumdisplay.php?fid=40 and show it as if
in
http://destek.10tl.net/forumdisplay.php?fid=40

I also tried with following in config, at top:

    location ~ \.html$ {
            rewrite ^/mybb/((?i)Forum-([^./]+))$

/mybb/forumdisplay.php?google_seo_forum=$2;
}

thanks for your helps.

Hi,

The rewrite you use contains /mybb/ but the URI does not. Rewrites work
on the URI and not the file path, so unless the information provided is
not accurate this is probably why your rewrite does not match.

Posted at Nginx Forum:

in fact, URI should not contain /mybb/
in php handling part, it is re-written to be /mybb/$1
to let php find that file in dir /mybb/

with my tests, I came to this point:

if I add this on top of conf:

    location ~ \.html$ {
            rewrite ^/forum-([0-9]+)\.html$ 

/forumdisplay.php?fid=$1;
rewrite ^/Forum-([0-9]+).html$
/forumdisplay.php?fid=$1;
}

when I write
http://destek.10tl.net/forum-40.html
or
http://destek.10tl.net/Forum-40.html

it is re-written to
http://destek.10tl.net/forumdisplay.php?fid=40

but,
this time the problem is: the url showing in address bar is changing.
What I want is: user should still see
http://destek.10tl.net/forum-40.html
in address bar, (after pressing enter/page loads) but it should process
http://destek.10tl.net/forumdisplay.php?fid=40
in background.

this is done in apache rewrite like this. and I (and my users) wants
this way.

can I achive this ?

here is a sample, similar site with apache running:
http://webboss.10tl.net/forum-48.html

thanks.