PHP change url style -
let's got file called test.php , can gather information using test.php?id=(id). i'm using iis , i've managed remove .php extensions each file, shows test?id=(id) i'm wondering how have if want show test/id/(id).
not quite sure google in situation, that's why i'm asking here. hope can me out bit, appreciated.
<?php $source_url="http://www.url.com/xyz/test.php?id=1234"; //to file name $url_info=pathinfo("http://www.url.com/xyz/test.php?id=1234"); if (!filter_var($source_url, filter_validate_url) == false) { //source_url valid url; $token_url = parse_url($source_url); //parameters of url $query = parse_url($source_url, php_url_query); parse_str($query, $output); echo $url_info['filename']."/id/".$output['id']; } ?>
Comments
Post a Comment