I have created APIs with sanctum authentication and moved the laravel application into the production server after uploading it to the server, the production API route are not working
- I have check my .htaccess files in my project structure
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<IfModule dir_module>
DirectoryIndex index.html index.html.var
</IfModule>
Also Change in RouteServiceProvider
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
- api.php file
Route::get('test',function(){
return 'Hello';
});
- url: http://{ipAddress}/api/test