1

I have deployed an API built using lumen 5.4 on shared hosting. I'm able to hit the the main domain elomena.xyz but cannot access elomena.xyz/users

Local server test with postman is successful but I get this error when i try to reach it from production environment

Not Found The requested URL /users was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

This is the content of my web.php file

$app->get('/', function () use ($app) {
    return $app->version();
});

// Users
$app->get('/users', 'UserController@index');
$app->post('/users', 'UserController@store');
$app->get('/users/{user_id}', 'UserController@show');
$app->put('/users/{user_id}', 'UserController@update');
$app->delete('/users/{user_id}', 'UserController@destroy');

// Orders
$app->get('/orders', 'OrderController@index');
$app->post('/orders', 'OrderController@store');
$app->get('/orders/{order_id}', 'OrderController@show');
$app->put('/orders/{order_id}', 'OrderController@update');
$app->delete('/orders/{order_id}', 'OrderController@destroy');

I can't find the reason why I can get to elomena.xyz but not elomena.xyz/users in production environment. I need help as i have been on this for over 48hrs already.

Mena
  • 1,873
  • 6
  • 37
  • 77
  • 2
    Is the server running Apache with mod_rewrite? Have you uploaded a htaccess-file? – M. Eriksson Apr 25 '18 at 11:06
  • There was no .htaccess in folder where index.php was. I upload one from my backup and that fixed it. That leads me to ask, for shared hosting shouldn't the htaccess file be created automatically? – Mena Apr 25 '18 at 11:23
  • There's no "rules" for how a shared hosting should behave. It's up to every hosting company. Even if the htaccess-file _would_ be created automatically, it shouldn't make any assumption about what it should contain (which is were the actual rewrite is defined). Different apps have different needs. – M. Eriksson Apr 25 '18 at 11:33

0 Answers0