As stated in the comments, the content of the global variable $_SERVER["REQUEST_URI"]
is of the form:
Novo/adm/categoria/1-Nome_Categoria
It was also expressed in the comments that the content of interest is just the part of adm
on, so just treat this value by removing what is not of interest. This can be done in many ways.
If the directory name does not change over time, just removing the contents of the string is enough:
$url = str_replace("Novo/", "", $_SERVER["REQUEST_URI"]);
In this way, $url
would be adm/categoria/1-Nome_Categoria
, as desired.
If the directory name is changeable over time, but there is always a directory, you can only remove the first part of the string until the first occurrence of /
:
$url = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], '/')+1);
The result will be the same regardless of the directory name, as long as there is one.
If there is a possibility that there is more than one directory, but that the URL will always start with adm
, you can search for it in your URL, like this:
$url = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], 'adm'));
The result would also be the same regardless of the number and name of the directories present in the URL.