1

I have small application developed in php. I am trying to access my phpfile from browser. I am using Ngnix server.

When I hit localhost/result.php it shows the echo message. But when I try to pass parameters in the url localhost/result.php/?phone=1234567890 , It gives

404 Page not found message.

Anyone who have faced this issue or know the solution, please let me know.

4
  • Please post your nginx configuration.
    – ayip
    Commented May 15, 2017 at 13:28
  • 2
    Did you mean to add an extra / before the ?? Commented May 15, 2017 at 13:37
  • @RichardSmith I mean when I pass variable after filename in URL, it doesn't treat it as variable and give me 404 'Page Not Found' error. Commented May 16, 2017 at 6:18
  • You have a filename /result.php and you have a query string ?phone=12345. Why is there a / in between the two? It changes /result.php to /result.php/ which looks like a directory and (may) be the cause of your 404 response. Commented May 16, 2017 at 8:44

1 Answer 1

1

Make sure your nginx configuration has something similar to the below line in the location block. The ?query_string at the end of it, ensures that it is passed along in your request.

try_files $uri $uri/ /index.html /index.php?$query_string;
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.