Please am using a Laravel script called laraclassified and google is still indexing some of my posts that not existing anymore i have been trying to edit the code on app/Exceptions/Handler.php but its not working below is the code
// Show AJAX requests exceptions (for API)
if ($request->ajax() || $request->wantsJson() || $request->segment(1) == 'api') {
$json = [
'success' => false,
'message' => $e->getMessage(),
'code' => $e->getCode(),
];
return response()->json($json, 400);
}
// Show HTTP exceptions
if ($this->isHttpException($e)) {
// Check if the app is installed when page is not found (or when 404 page is called),
// to prevent any DB error when the app is not installed yet
if (method_exists($e, 'getStatusCode')) {
if ($e->getStatusCode() == 404) {
if (!appIsInstalled() && $request->input('exception') != '404') {
return redirect(getRawBaseUrl() . '/install?exception=404');
}
}
}
return $this->renderHttpException($e);
}
Please help, how can i use the above code to redirect all 404 errors to homepage
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire