I am trying to create a small application that uses Laravel REST api as backend and Angular for frontend.
I've managed to display json on the browser in localhost but when I uploaded to 1and1.com server, the index page works fine but api ur such as - xyz.com/public/names gives a 404 page not found error.
My Directory structure
empdir
empdir-backend
laravel
empdir-frontend
js
css
index.html
Am I missing some thing.
This is my Route.php
Route::get('/', function () {
return view('welcome');
});
Route::get('names', function () {
$data = array(
1 => "John",
2 => "Mary",
3 => "Steven"
);
return view('rest', $data);
});
Route::get('names/{id}', 'NameController@showEmpDetail');
Route::resource('names', 'NameController');
Controller.php
public function index()
{
return array(
1 => "John",
2 => "Mary",
3 => "Steven"
);
}
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]