Support the ongoing development of Laravel.io →
Laravel Laravel.io
Last updated 1 year ago.
0

Routes defined in api.php have api prefix defined automatically

Change this

Route::get('/api/mail/send', 'MailController@index');

to this

Route::get('/mail/send', 'MailController@index');
Last updated 5 years ago.
0

I considered that as well but I still get the 404 when I do this: http://api.mywebsite.com/api/api/mail/send

Even when I created a new route: Route::get('/mailer', 'MailController@index'); and did this I got a 404: http://api.mywebsite.com/mailer

So not sure what I am doing wrong?

0

If you have your nginx configured correctly for api subdomain (I am not very experienced in nginx) you need to access:

http://api.mywebsite.com/api/mailer

if you have this route inside api.php

Route::get('/mailer', 'MailController@index');
Last updated 5 years ago.
0

Hmm yeah thats exactly what I have and tried, so I feel it must me my nginx setup which I also do not have experience (first time deploying my laravel api to production). Maybe someone here hass some experience

0

ah found the problem maybe: root /mywebsite/api/public; should have been root /root/mywebsite/api/public;

But when I do this I new get a 403?

Last updated 5 years ago.
0

laravel lives in /public whether you use api or not , try mywebsite/public

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.