Welcome! Log In Create A New Profile

Advanced

URI path as variables in PHP

Posted by r31griffo 
URI path as variables in PHP
May 23, 2023 11:43PM
G'day everyone,

I'm hoping someone will be able to assist with this. I'm using Nginx and would like to tidy the URI to make it easily readable (this will also help me as I'll be typing these in occasionally). Is it possible to convert part of the URI so it passes the path as variables to PHP?

So far my Googling seems to suggest I should be looking into the "location" option in my /etc/nginx/sites-enabled/*.conf file, but I'm not really sure what to do with it...

example
To pass "staffid" and "entry" variables to the PHP script located in /var/www/fetch/index.php I would enter:
http://servername/fetch/?staffid=12345678&entry=1221

Ideally I'd like to use this:
http://servername/12345678/1221
but it would need an exclusion if no path/variables are entered to go to ./index.php

I would also be very happy with this:
http://servername/fetch/12345678/1221
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready