How to get complete current url for Cakephp

Passionate Engineer picture Passionate Engineer · Jul 26, 2011 · Viewed 136k times · Source

How do you echo out current URL in Cake's view?

Answer

Abba Bryant picture Abba Bryant · Jul 29, 2011

You can do either

From a view file:

<?php echo $this->request->here() ?>">

Which will give you the absolute url from the hostname i.e. /controller/action/params

Or

<?php echo Router::url(null, true) ?> 

which should give you the full url with the hostname.