php - How to get the right try_files $uri directive working with _GET parameters in nginx -
I have just migrated from apache to nginx, and am very happy now. However, the server does not seem to recognize the $ _GET parameter.
I've read that the answer is to change the_files command:
location / {try_files $ uri $ uri / /index.php?$query_string; }
But this is not working for me I suspect because the query string I am using is something that has something like URL:
http://www.mysite.com/thedirectory/thefile?sortby=director
I still can not try the try_files directive to work in that example , And the documentation looks sparse or obsolete.
Any thoughts? If I do not find this solution, then I will have to go back to Apache.
I do not know where you got the answer, but do not see relevance in terms of your problem Let's clarify something first:
- Try_files is a URI match with a physical location on the disk and allows you to control the fallback operation.
- Default Fallback A 404
- $ query_string is not relevant to the matching process. It is used for try_files, where some query string is to add something.
There are three possible causes and solutions to your problem:
-
Yuri matches a real file, but without the file extension, The php processing location is not triggered, in this case your statement should be:
try_files $ uri $ uri / $ uri.php;
-
This is a virtual location and the router has index.php, as it is with many applications, such as WordPress and Magenta. In this case try_files should be the following:
try_files $ uri $ uri / @appname;
@appname is not possible without providing more context to providing a single location block.
- You are not including the relevant fatigue-less instructions. In this case your try_files is noise. First, fix the actual problem, by including the information given to Fastcase_Pal, mentioned in the comment.
Comments
Post a Comment