$page = parse_url($_SERVER['PHP_SELF']); echo $page['path']; 

Always gives index.php on all pages. And I need one of the specific urls to display my css.

    1 answer 1

    The element $ _SERVER ['PHP_SELF']

    The element $ _SERVER ['PHP_SELF'] contains the name of the script, starting from the root directory of the virtual host, i.e. if the query string is an address

     http://www.mysite.ru/test/index.php?id=1&test=wet&id_theme=512 

    then the element $ _SERVER ['PHP_SELF'] will contain the fragment "/test/index.php". As a rule, the same fragment is placed in the $ _SERVER ['SCRIPT_NAME'] element.

    Full address to the script

     <?php echo "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?> 
    • Thanks, it helped. By the way, the CNC also turns out refers to the index (mine). Thank you so much for the clarification. - Happy_Cougar