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:

  1. Try_files is a URI match with a physical location on the disk and allows you to control the fallback operation.
  2. Default Fallback A 404
  3. $ 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:

  1. 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;

  2. 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.

  1. 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

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -