nginx rewrite help
    bvidinli 
    bvidinli at gmail.com
       
    Mon Sep 27 17:36:56 MSD 2010
    
    
  
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.
    
    
More information about the nginx
mailing list