Skip to content

Commit a1076c1

Browse files
committed
Explain what a fallback route is
1 parent 6e91dbe commit a1076c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ Route::fallback(\CodeZero\LocalizedRoutes\Controllers\FallbackController::class)
384384

385385
Because the fallback route is an actual `Route`, the middleware will run and update the locale.
386386

387+
The fallback route is a "catch all" route that Laravel provides.
388+
If you type in a URL that doesn't exist, this route will be triggered instead of a typical 404 exception.
389+
387390
The `FallbackController` will attempt to respond with a 404 error view, located at `resources/views/errors/404.blade.php`.
388391
If this view does not exist, the normal `Symfony\Component\HttpKernel\Exception\NotFoundHttpException` will be thrown.
389392
You can configure which view to use by changing the `404_view` entry in the config file.
@@ -657,6 +660,11 @@ To redirect any non-localized URL to its localized version, you can set the conf
657660
Route::fallback(\CodeZero\LocalizedRoutes\Controllers\FallbackController::class);
658661
```
659662

663+
The fallback route is a "catch all" route that Laravel provides.
664+
If you type in a URL that doesn't exist, this route will be triggered instead of a typical 404 exception.
665+
666+
The `FallbackController` will attempt to redirect to a localized version of the URL, or return a [localized 404 response](#-localize-404-pages) if it doesn't exist.
667+
660668
For example:
661669

662670
| URI | Redirects To |

0 commit comments

Comments
 (0)