Problem with simple rewrite rule

Igor Sysoev is at rambler-co.ru
Mon Mar 10 12:07:57 MSK 2008


On Sun, Mar 09, 2008 at 08:01:44PM +0100, Per Hans Hansen wrote:

> I try to create a very simple rewrite rule with nginx, but i doesnt work.
> 
> I have set up my server with a "catch all" server_name *.mydomain.com
> 
> I then try to create a rewrite rule so that requests to
> mysubdomain.mydomain.com/wiki.php?wiki=WIKIPAGE will be rewritten to
> mysubdomain.mydomain.com/WIKIPAGE
> 
> Here is the option that i thought would work:
> 
>        server {
>              server_name mysubdomain.domain.com;
>              if (!-e $request_filename) {
>              rewrite ^/(.*)$ /wiki.php?wiki=$1 last;
>              }
>         }
> 
> Suggestions to why this does not work are highly appreciated.

I do not understand.

You said, you want to rewrite

/wiki.php?wiki=WIKIPAGE => /WIKIPAGE

but your rewrite do opposite thing:

/WIKIPAGE => /wiki.php?wiki=WIKIPAGE

What exactly do you want ?


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list