I currently have my htaccess file set to remove the file type so
www.example.com/home.php
would become,
www.example.com/home
I need to compare the url with one that I have saved in the database, I do this by,
if ($_SERVER['QUERY_STRING']) {
$pageURL = str_replace('.php', '?', 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']);
}
else {
$pageURL = substr('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'], 0, -4);
}
When I save the url in the database it gets saved as the current page url after the htaccess file has removed the .php, it is inserted using jquery ajax.
When I come to compare it, I need this to make it match in php as php doesn't take into account the htaccess changes.
Is there a better way to do this?