title: Laravel How to remove "api" Prefix from subdomain URL
body: <p>I have created a Laravel application which is both Web application and  provides REST APIs to android and iOS platforms.</p>
  
  <p>I have two route files one is api.php and other is web.php and routes\api.php routing as follows:</p>
  
  <pre><code>routes/api.php
      Route::group([
      'domain'=&gt;'api.example.com',
      function(){
          // Some routes ....
      }
  );
  </code></pre>
  
  <p>and nginx serve blocks configured can be seen here </p>
  
  <pre><code>server {
  listen 80;
  listen [::]:80;
  
  root /var/www/laravel/public;
  index index.php;
  server_name api.example.com;
  
  location / {
      try_files $uri $uri/ /index.php$is_args$args;
  }
  
  location ~ \.php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I was be able to access my application using <code>http://example.com</code> for web application and  <code>http://api.example.com/api/cities</code> for REST API's. But the subdomain URL contains <strong>api</strong> as prefix as given below.</p>
  
  <pre><code>http://api.example.com/api/cities
  </code></pre>
  
  <p>But i want to my subdomain like this <code>http://api.example.com/cities</code> (I wanted to <code>remove</code> api prefix from the sub domain URL).</p>
  
  <p>Is it right way to remove prefix <strong>api</strong> in <code>RouteServiceProvide.php</code> for api routes?</p>
  
  <p>Or is they any right way to implement this?</p>
  
  <p>Environment Details
  Laravel 5.5 (LTS)
  PHP 7.0</p>