nginx rewrite help

bvidinli bvidinli at
Mon Sep 27 19:10:13 MSD 2010

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

it is re-written to

this time the problem is: the url showing in address bar is changing.
What I want is: user should still see
in address bar, (after pressing enter/page loads) but it should process
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:


On Mon, Sep 27, 2010 at 4:59 PM, Ensiferous <nginx-forum at> wrote:
> 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:,134553,134565#msg-134565
> _______________________________________________
> nginx mailing list
> nginx at

More information about the nginx mailing list