I have a page at example.com/fruit.php
. The page uses ISSET()
to parse parameters to decide what to show the user. For instance, example.com/fruit.php?name=apple&color=red
. This is easy enough to do but I'd rather the requests to come to the page like this:
mysite.com/fruit/apple/red
Since I know there will only be two parameters, I can easily parse the url to build my page. However, how can I configure nginx so that every request for example.com/fruit
with anything behind the url should be sent to fruit.php so that the page itself can parse the url. Here is what I have tried in my location block:
location ~ /fruit {
return 301 https://www.example.com/fruit.php;
}
This is not working for me and I've got about a day wrapped up in trying to figure it out. Any help would be appreciated.