Ad

My Laravel Route Return 404 Error But Route Exists?

I'm using laravel 5.6 and i've just started create api using Laravel framework and I'm having an issue with routing.

The only route that's working like that

http://my-domain-name.com/index.php/api/my-api-name

if i romve index.php from my url :-

http://my-domain-name.com/api/my-api-name

then i got 404 not found error.

How can i fix this?

Ad

Answer

check out your Apache config, it have to be like that:

<VirtualHost laravel.dev:80>
  DocumentRoot "C:\xampp\htdocs\laravel\public"
  ServerAdmin laravel.dev
  <Directory "C:\xampp\htdocs\laravel">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
  </Directory>
</VirtualHost>
Ad
source: stackoverflow.com
Ad