title: Laravel: How to configure api.php routes for shared hosting?
body: <p>I have the following .htaccess fille:</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews -Indexes
      &lt;/IfModule&gt;
  
      RewriteEngine On
  
      # Handle Authorization Header
      RewriteCond %{HTTP:Authorization} .
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} (.+)/$
      RewriteRule ^ %1 [L,R=301]
  
      # Send Requests To Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  &lt;/IfModule&gt;
  
  #disable directory browsing
  Options -Indexes
  
  #PROTECT ENV FILE
  &lt;Files .env&gt;
  order allow,deny
  Deny from all
  &lt;/Files&gt;
  
  #PROTECT ENV FILE
  &lt;Files .htaccess&gt;
  order allow,deny
  Deny from all
  &lt;/Files&gt;
  </code></pre>
  <p>But the problem is I get a 404 status code in my production environment when trying to load &quot;getservicedata&quot; from a vue.js component. I think the problem is in the URL because it works when I type in the correct url, but the problem is the app loads the API from wrong URL.</p>
  <p>I followed this guide to setup laravel shared hosting: <a href="https://laravelarticle.com/deploy-laravel-on-shared-hosting" rel="nofollow noreferrer">https://laravelarticle.com/deploy-laravel-on-shared-hosting</a></p>
  <p><a href="https://i.stack.imgur.com/trxg1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/trxg1.png" alt="404 status code" /></a></p>
  <p><a href="https://i.stack.imgur.com/9VkOd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9VkOd.png" alt="200 status using the correct url" /></a></p>