My goal is to get everything after the domain name into a string. As in mysite.com/page/page2 would result in a string \"page/page2\". That I can do, however it starts givin
You could use $_SERVER['REQUEST_URI'] and then modify the string with PHP's substr() function. So, put the URI into a variable and then run that function to remove the first X number of characters (domain name length) from the beginning and X number of characters from the end (index.php = 9).
For example:
$new_url = substr($uri_variable, 10, -9);
Where $uri_variable is the $_SERVER[REQUEST_URI']`, 10 is the character after the domain name and -9 is the characters in index.php.
https://www.php.net/manual/en/reserved.variables.server.php http://php.net/manual/en/function.substr.php