<p>You're probably looking for something like:</p>

<pre><code>craft()-&gt;request-&gt;getHostInfo().craft()-&gt;request-&gt;getRequestUri();
</code></pre>

<p>Which will return the host name with the schema it's using (http:// or https://) as well as any URI after the host including any querystring parameters.</p>

CC BY-SA 3.0
2014-09-14T03:35:36.137Z
2014-09-14T03:35:36.137Z
Brad Bell
<p>When writing a plugin is there a Craft request to grab the entire url? I want to grab everything including <a href="http://domain.com/uri" rel="nofollow">http://domain.com/uri</a> preferably without writing my own function.</p>

<p>I see <a href="http://buildwithcraft.com/docs/templating/craft.request#getUrl" rel="nofollow">getUrl</a> but <code>craft()-&gt;request-&gt;url</code> only returns 'uri' of <a href="http://domain.com/uri" rel="nofollow">http://domain.com/uri</a>.</p>

<plugin-development><url><siteurl>
How to grab the full URL in a plugin?
# How to grab the full URL in a plugin?

(Asked by: username_0 on 2014-09-14)

When writing a plugin is there a Craft request to grab the entire url? I want to grab everything including <http://domain.com/uri> preferably without writing my own function.

I see [getUrl](http://buildwithcraft.com/docs/templating/craft.request#getUrl) but `craft()->request->url` only returns 'uri' of <http://domain.com/uri>.

**Tags:** plugin-development, url, siteurl


---

## 1 answers

### Answer by username_1 on 2014-09-14. Score: 5 | Accepted answer

You're probably looking for something like:
craft()->request->getHostInfo().craft()->request->getRequestUri();

Which will return the host name with the schema it's using (http:// or https://) as well as any URI after the host including any querystring parameters.


---

