Reputation: 301
i usually use development laravel with artisan, but in this case i must set laravel in lampp. i have route like
Route::group(['middleware' => 'cors', 'prefix' => 'service'], function () {
Route::group(['prefix' => 'master'], function () {
Route::resource('produk', 'Master\ProdukController');
Route::resource('agama', 'Master\AgamaController');
});
Route::resource('list-generic', 'ListGeneric', ['only' => ['index']]);
});
and my .htacess in public folder:
<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]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
my problem is. when i access this link:
http://172.16.16.1/a-web/service/list-generic?select=id
it perfectly work, but when i access with this link with "/" after list-generic:
http://172.16.16.1/a-web/service/list-generic/?select=id
show error object not found, please need help..
Upvotes: 1
Views: 846
Reputation: 301
i have found solution for my own question. finally i must edit .httaccess file:
Options -MultiViews
RewriteEngine On
RewriteBase /a-web/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ $1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Upvotes: 1
Reputation: 4435
This must be because of your route file.
When you add
Route::resource('list-generic', 'ListGeneric', ['only' => ['index']]);
Laravel will only use the route
http://172.16.16.1/a-web/service/list-generic
and Not
http://172.16.16.1/a-web/service/list-generic/
for the above route to work you will have to add the optional parameter to the route
Route::resource('list-generic/{?query}', 'ListGeneric', ['only' => ['index']]);
This route will handle all both type of links.
Upvotes: 1