title: Subdomain for Laravel Rest API not working correctly - IONOS using Plesk
body: <p>I've got a VPS with IONOS (was 1&amp;1) and running Plesk Obsidian and I am up to date using Laravel 9. Now I've hit a snag, all I want to do is add a simple subdomain :-</p>
  <p><strong>api.trolleyspotting.fun</strong></p>
  <p>So what would be <code>https://trolleyspotting.fun/api/v1/trolleys/all</code></p>
  <p>points to
  <code>https://api.trolleyspotting.fun/v1/trolleys/all</code></p>
  <p>My issue is when I add the following code to <code>routes/api.php</code></p>
  <p><code>Route::domain('api.' . env('APP_URL'))-&gt;group(function() {</code></p>
  <pre><code>`Route::get('v1/trolleys/all', [ApiController:class, 'index']);`
  </code></pre>
  <p><code>});</code></p>
  <p>And then go to <code>https://api.trolleyspotting.fun/v1/trolleys/all</code> nothing happens! I added an A record for the subdomain in IONOS Domain control panel and it points to the VPS IP address. When I install the laravel application and try to do as above it just does not work. Where am I going wrong? It's added no problem on the Plesk side as a subdomain. Do I need to add something in <code>routes/web.php</code> ? I've tried just adding the A record for the subdomain and adding it to the DNS side on Plesk but not physically adding it as a subdomain with its own directories but that didn't work either. I am reaching the end of my patience because I'm not a novice and I have read up but no solutions on here or in tutorials (YouTube too) have worked.</p>
  <p>Any advice or answers very much appreciated in advance.</p>
  <p>Thanks!</p>