Hi Francis, Thank you for the response.
Possibly using "location ^~ /test/" would work? > > http://nginx.org/r/location > > You may want to rewrite to /test.php (with the leading slash), though. > > Although, better might be to just fastcgi_pass directly, rather than > rewriting. > > Something like (untested) > > location ^~ /test/ { > fastcgi_param SCRIPT_FILENAME $document_root/test.php; > fastcgi_param QUERY_STRING q=$uri; > include fastcgi_params; > fastcgi_pass 127.0.0.1:9000; > } > > although you would want to change the QUERY_STRING line to match what > you need; and you may need to switch the position of the "include", > depending on how your fastcgi server handles repeated params. > There are over 300 rewrites under 54 location blocks. I tried using ^~ as you suggested. Now the rewrite is working correctly, but the files are not executed. The request is returning the actual PHP source file, not the HTML generated by executing the script. > > location ~ [^/]\.php(/|$) { > > fastcgi_split_path_info ^(.+?\.php)(/.*)$; > > > > set $fastcgi_script_name_custom $fastcgi_script_name; > > if (!-f $document_root$fastcgi_script_name) { > > set $fastcgi_script_name_custom "/cms/index.php"; > > } > > I suspect that it should be possible to do what you want to do there, > with a "try_files". But I do not know the details. > There is a CMS engine which will intercept all unmatched requests and check the database to see if there is an article with that URI. Some times it has to match existing directories without index.php. If I use try_files, it will either lead to a 403 error (if no index is specified), or would internally redirect the request to the index file (if it is specified), leading to 404 error. The if condition correctly handles all the non-existing files.
_______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
