I removed the ".php" suffix at the end of the PHP files on the Nginx server with the following code, but this time I cannot send some data to the server.
try_files $uri/ $uri.html $uri.php$is_args$query_string;
Some links on the site are sent with Ajax, and the ".php" extension is not available at the end of these links. E.g; https://panel.example.com/app/controller/ajax/collect
For example, when I want to access the "/collect" file that I want to access via Ajax or directly, I get the error "File not found". Because I do "rewrite" with the code below and provide a clean URL.
rewrite ^/([^/]+)/([^/]+)?$ /index.php?cmd=$1&scd=$2 last;
rewrite ^/([^/]+)/?$ /index.php?cmd=$1 last;
Sample link: https://panel.example.com/[details|cat|profile]/[subPages(productID, username..)]
As a result, the above codes are correct and working, but not working at the same time together. How can I run these two codes at the same time?