A blog & community for non-professional web designers, programmers, webmasters, and other web savvies.

Display Current Page URL

October 14, 2010 - 12:00am -- Thomas

This PHP script will display the current page URL to your site's visitors.

<?php
/*****************
--Display Current Page URL
--More PHP Scripts at
--http://icecaves.net/tags/php
*****************/
if (!empty($_SERVER['HTTPS'])) {
$start = "https://";
}
else
{
$start = "http://";
}
$hostname = $_SERVER['SERVER_NAME'];
$url = $_SERVER['REQUEST_URI'];
echo
"$start$hostname$url";
?>
Code Preview: 
http://icecaves.net/2010/10/display-current-page-url
Tags: 
Forum Board: 

@IceCaves on Twitter

    Stay Connected

    Twitter Facebook Tumblr Google+ Glaciallis Google RSS

    *Follow us on Twitter or Facebook to also follow minor site updates that don't make it to the homepage news.