I use this code to parse the URL
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
print_r(parse_url(curPageURL()));
echo parse_url($url, PHP_URL_PATH);
It work when the URL be like this :
test.com/index.php/aaa
It returns "index.php/aaa" but I dont want index.php be in the URL,I want the url to be like this, for example:
test.com/aaa
and then return "aaa" but it shows 404 error. How can I solve my issue? i think i must change something in ".htaccess" but if i change "index.php" instead 404 page ,there's no 404