Is there a way, using the functionality in ZF, to get the full url
(http[s]::/xxx.yyyy.ddd/ggg/hhh)
I am currently in?
baseUrl() will only give me the path, not the domain and sub domain.
I know how to extract it from the $_SERVER, trying to avoid that.
Use getRequest() method of your controller to get an instance of Zend_Controller_Request_Http object. then try the getHttpHost() method of the request object. so in your controller, it would be like this:
$hostName = $this->getRequest()->getHttpHost();
Construct your full URL like the following:
$this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getRequestUri();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With