<p><code>craft::$app-&gt;urlManager-&gt;createUrl</code> will always return an action url because in the end this function does <code>return UrlHelper::actionUrl($route, $params);</code></p>

<p>You want to create a basic site url so you need to do</p>

<pre><code>UrlHelper::url('', ['state' =&gt; 'KR'] )
</code></pre>

CC BY-SA 3.0
2018-04-14T18:28:03.983Z
2018-04-14T18:28:03.983Z
Robin Schambach
<p>Writing a plugin and creating some links. Trying to use:</p>

<pre><code>$url = craft::$app-&gt;urlManager-&gt;createUrl(['', 'state' =&gt; 'KS']);
</code></pre>

<p>to create a URL. I am expecting:</p>

<blockquote>
  <p><a href="http://test.com/index.php?state=KS" rel="nofollow noreferrer">http://test.com/index.php?state=KS</a></p>
</blockquote>

<p>but get:</p>

<blockquote>
  <p><a href="http://test.com/index.php?p=actions&amp;state=KS" rel="nofollow noreferrer">http://test.com/index.php?p=actions&amp;state=KS</a></p>
</blockquote>

<p>That results in the following error:</p>

<blockquote>
  <p>HTTP 404 – Not Found – yii\web\NotFoundHttpException
  Template not found: actions</p>
</blockquote>

<p>What is the p=actions that is being added to the url? I am a bit confused by this.</p>

<craft3>
createUrl adding p=actions
# createUrl adding p=actions

(Asked by: username_0 on 2018-04-14)

Writing a plugin and creating some links. Trying to use:
$url = craft::$app->urlManager->createUrl(['', 'state' => 'KS']);

to create a URL. I am expecting:

http://test.com/index.php?state=KS

but get:

http://test.com/index.php?p=actions&state=KS

That results in the following error:

HTTP 404 – Not Found – yii\web\NotFoundHttpException
  Template not found: actions

What is the p=actions that is being added to the url? I am a bit confused by this.

**Tags:** craft3


---

## 1 answers

### Answer by username_1 on 2018-04-14. Score: 3 | Accepted answer

craft::$app->urlManager->createUrl will always return an action url because in the end this function does return UrlHelper::actionUrl($route, $params);
You want to create a basic site url so you need to do
UrlHelper::url('', ['state' => 'KR'] )


---

