<p>Das Problem lag an der Craft CMS Version &lt; <code>4.8.1</code> / <code>4.8.2</code>.</p>
<p>Konnte mit <code>4.8.3</code> geloest werden.</p>

CC BY-SA 4.0
2024-03-22T06:57:44.180Z
2024-03-22T06:57:44.180Z
Leonardo
<p>We are trying to run Craft CMS not under <code>example.com</code> but under <code>example.com/subpath</code>.
So we want the following paths:</p>
<ul>
<li>Frontend: <code>example.com/subpath</code></li>
<li>controlPanel: <code>example.com/subpath/admin</code></li>
</ul>
<p>In the <code>.env</code></p>
<pre><code>PIRMARY_SITE_URL=example.com/subpath
</code></pre>
<p>Which is also used inside the Settings for the base url.</p>
<p>In the <code>general.php</code></p>
<pre><code>-&gt;aliases([
        '@web' =&gt; App::env('PRIMARY_SITE_URL'),
        '@webroot' =&gt; dirname(__DIR__) . '/web',
    ])
    -&gt;baseCpUrl(App::env('PRIMARY_SITE_URL'))
</code></pre>
<p>Everything &quot;works&quot;. Except axios requests.
For example: trying to login to the controlpanel results into an 404. Because it tries to call <code>http://example.com/index.php?p=admin%2Factions%2Fusers%2Flogin&amp;v=1709708188780</code></p>
<blockquote>
<p>deleting the cpressourcen does nothing. axios somewhere gets the wrong base url.</p>
</blockquote>
<p>I think im missing a setting. I don not thing their is a problem with the webserver?</p>
<p>Greetings</p>

<url><config><craft4><routing>
Running Craft on a subpath
# Running Craft on a subpath

(Asked by: username_0 on 2024-03-06)

We are trying to run Craft CMS not under example.com but under example.com/subpath.
So we want the following paths:

Frontend: example.com/subpath
controlPanel: example.com/subpath/admin

In the .env
PIRMARY_SITE_URL=example.com/subpath

Which is also used inside the Settings for the base url.
In the general.php
->aliases([
        '@web' => App::env('PRIMARY_SITE_URL'),
        '@webroot' => dirname(__DIR__) . '/web',
    ])
    ->baseCpUrl(App::env('PRIMARY_SITE_URL'))

Everything "works". Except axios requests.
For example: trying to login to the controlpanel results into an 404. Because it tries to call http://example.com/index.php?p=admin%2Factions%2Fusers%2Flogin&v=1709708188780

deleting the cpressourcen does nothing. axios somewhere gets the wrong base url.

I think im missing a setting. I don not thing their is a problem with the webserver?
Greetings

**Tags:** url, config, craft4, routing


---

## 1 answers

### Answer by username_0 on 2024-03-22. Score: 1 | Accepted answer

Das Problem lag an der Craft CMS Version < `4.8.1` / `4.8.2`.

Konnte mit `4.8.3` geloest werden.


---

