Answer the question
In order to leave comments, you need to log in
Routing Laravel and Cyrillic?
Good afternoon. Tell me, what needs to be done so that links with Cyrillic are processed in Laravel 4.2?
There is a rule in routes.php:
Route::pattern('userName', '[\d\w]{1,16}');
Route::get('user/{userName}', '[email protected]');
Answer the question
In order to leave comments, you need to log in
And if pattern is written as .*
- does it work?
In general, the Cyrillic alphabet must be encoded throughurlencode
Laravel knows everything. You just need to make a regexp so that Cyrillic characters are taken into account.
For example:
Route::get('test/{slug}', function($slug = null){
return 'Hello World, '.$slug;
})->where('slug', '[^0-9\p{Cyrillic}]+');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question