My goal is to get everything after the domain name into a string. As in mysite.com/page/page2, you will get the string "page / page2". I can do this, but it starts to give me problems when, for example, the site is in a subfolder, and not in the root directory, then the folder in which the site is located will also be included in the line, and if I do not use mod_rewrite to get pretty links, it will also add index.php to the string.
So, I will need a trick or two to understand the script whether the site is in a subfolder such as mysite.com/sitefolder/page/page2, and that it will still result in a line
page/page2
If the site does not use mod_rewrite and the url is mysite.com/sitefolder/index.php/page/page2, it will still result in a string
page/page2
Keep in mind that I have the URL and USE_MOD_REWRITE defined in the configuration file, so there is no need for magic. I just don't know how to do this. I know I can do $ _SERVER ['REQUEST_URI'] to get the string, but then index.php will still be in it. I apologize if I do not explain well enough, but all help is appreciated.
source share