if you want just the parts of url after http://domain.com, try this:
<?php echo $_SERVER['REQUEST_URI']; ?>
if the current url was http://domain.com/some-slug/some-id, echo will return only '/some-slug/some-id'.
if you want the full url, try this:
<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>