Hi All, <br><br>My webapp is a combination of two apps running on one server. <br><br>the community app (smaller one) is located under community directory and the all urls starting with community should be handled by it<br>

e.g. <a href="http://example.com/community/questions" target="_blank">example.com/community/questions</a> example,com/community/2/an-actual-qestion etc etc<br><br>The main app takes care of rest of  URLs such as <a href="http://example.com" target="_blank">example.com</a> (which should redirect to <a href="http://example.com/city" target="_blank">example.com/city</a>) <a href="http://example.com/city/sampledir" target="_blank">example.com/city/sampledir</a> etc etc<br>

<br>the location blocks I have used are<br>----------------------<br>#handle community section separately<br>    location ^~ /<b>community</b>/ {<br>        try_files $uri $uri/ /index.php?qa-rewrite=$uri&$args;<br>        location ~ \.php$ {<br>

            fastcgi_pass   <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>;<br>            fastcgi_index  index.php;<br>            include fastcgi_params;<br>            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;<br>

            fastcgi_param PATH_INFO $fastcgi_script_name;<br>            access_log off;<br>        }<br>    }<br><br>    location =/ {<br>        #convert domain to domain/city <br>        rewrite ^(.*)$ $scheme://<a href="http://example.com/city">example.com/city</a> permanent;<br>

    }<br>    <br>   #these locations always use /city as prefix<br>   location ~^/(biz|biz/|profiles|profiles/) {<br>        rewrite ^(.*)$ $scheme://<a href="http://example.com/city$1">example.com/city$1</a> permanent;<br>
    }<br>    <br>    #main app should handle everything except community    <br>    location<b> /</b> {<br>
        #remove trailing slash<br>        rewrite ^/(.*)/$ /$1 permanent;<br>        #NB this will remove the index.php from the url<br>        try_files $uri $uri /index.php?$args;<br>    }<br><br>    location ~ \.php$ {<br>

        fastcgi_pass   <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>;<br>        fastcgi_index  index.php;<br>        include fastcgi_params;<br>        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;<br>

        fastcgi_param PATH_INFO $fastcgi_script_name;<br>        access_log off;<br>    }<br>-------------------------------<br>With this code the main app works fine but the community app ONLY works for <a href="http://example.com/community/" target="_blank">example.com/community/</a> and <a href="http://example.com/community/?a=foo/bar" target="_blank">example.com/community/?a=foo/bar</a> etc etc but <b>NOT</b> for <span style="color:rgb(255,0,0)"><a href="http://example.com/community/foo/bar" target="_blank">example.com/community/foo/bar</a></span><br>

<br>I think <a href="http://example.com/community/foo/bar" target="_blank">example.com/community/foo/bar</a> doesn't get handled by the community location block and goes to the main location which gives 404 error.<br>
<br>I tried various combination for location but nothing is fixing it perfectly. I will appreciate any pointers / help. <br>
<br>Thanks,<br>Nikhil<br>