nginx rewrite help

bvidinli bvidinli at gmail.com
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
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.


On Mon, Sep 27, 2010 at 4:59 PM, Ensiferous <nginx-forum at nginx.us> 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: http://forum.nginx.org/read.php?2,134553,134565#msg-134565
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list