<?php
	error_reporting(0);
	$request = $_SERVER['REQUEST_URI'];
	if(strstr($request,".php")||strstr($request,".PHP"))
	{
	    $url_php_text = '';
	    $url_php_text2 = explode(".php", $request);
	    for ($x=0; $x <count($url_php_text2) ; $x++) { 
	        $url_php_text =  $url_php_text.$url_php_text2[$x];
	    }
	    $url_php_text2 = explode(".PHP", $url_php_text);
	    $url_php_text = '';
	    for ($x=0; $x <count($url_php_text2) ; $x++) { 
	       $url_php_text =  $url_php_text.$url_php_text2[$x];
	    }
	    $url_php_text3 = explode("?", $url_php_text);
	    $url_php_text4 = explode("/", $url_php_text3[0]);
	    if($url_php_text4[count($url_php_text4)-1]==''){
	        $url_php_text3[0] = $url_php_text3[0];
	    }
	    else{
	        $url_php_text3[0] = $url_php_text3[0].'/';
	    }
	    if($_SERVER["QUERY_STRING"]==''){
	        $url_php_text5 = '';
	    }else{
	        $url_php_text6 = '';
	        $url_php_text2 = explode(".php", $_SERVER["QUERY_STRING"]);
	        for ($x=0; $x <count($url_php_text2) ; $x++) { 
	           $url_php_text6 =  $url_php_text6.$url_php_text2[$x];
	        }
	        $url_php_text2 = explode(".PHP", $url_php_text6);
	        $url_php_text6 = '';
	        for ($x=0; $x <count($url_php_text2) ; $x++) { 
	           $url_php_text6 =  $url_php_text6.$url_php_text2[$x];
	        }
	        $url_php_text5 = '?'.$url_php_text6;
	    }
	    header('Location: '.$url_php_text3[0].$url_php_text5);
	}else{
	    $url_php = explode("?", $request);
	    $url_php_text = $url_php[0].'/'; 
	    $url_php2 = explode("?", $_SERVER["QUERY_STRING"]);
	    $url_php3 = explode("//", $url_php_text);
	    if($_SERVER["QUERY_STRING"]==''){
	        $url_php_text = $url_php3[0].'/'.$url_php2[0];
	    }else{
	        $url_php_text = $url_php3[0].'/?'.$url_php2[0];
	    }
	    $url_php_text2 = '';
	    $url_php_text3 = explode("/", $url_php_text);
	    for($i=0;$i<count($url_php_text3);$i++){
	        $url_php_text2 = $url_php_text2.$url_php_text3[$i];
	        if($url_php_text3[$i+1]==''){
	            $url_php_text2 = $url_php_text2;
	        }else{
	            $url_php_text2 = $url_php_text2.'/';
	        }
	    }
	    if($_SERVER["QUERY_STRING"]==''){
	        $url_php_text2 = $url_php_text2.'/';
	    }
	    if($_SERVER['REQUEST_URI']==$url_php_text2){

	    }else{
	        header('Location: '. $url_php_text2);
	    }
	}
	$url_php_text7 = explode("/?", $url_php_text2);
	if($url_php_text7[1]==''){  
	    $url_php_link = $url_php_text7[0];
	}else{
	    $url_php_link = $url_php_text7[0].'/';
	}
	if($url_php_text7[1]==''){
	    $url_php_get = "";
	}else{
	    $url_php_get = "?".$url_php_text7[1];
	}
?>