laravel-localization
laravel-localization copied to clipboard
Disable Redirects Only for 404 Requests
I couldn't find it in config file, can we disable redirects for some requests or 404 requests?
configration file is config/laravellocalization.php
but for creation should use this: php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
so, the config file created automaticly.
if you are use Laravel 10.X
i gues not compitable. for solution, i am using like this: <a href="{{Laravellocalization::localizeUrl('/anythink')}}">Link</a>
. so your URLs will change to: ``http://127.0.0.1:8000/en/anythink`
sorry for bad English, good code!
configration file is
config/laravellocalization.php
but for creation should use this:php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
so, the config file created automaticly.if you are use
Laravel 10.X
i gues not compitable. for solution, i am using like this:<a href="{{Laravellocalization::localizeUrl('/anythink')}}">Link</a>
. so your URLs will change to: ``http://127.0.0.1:8000/en/anythink`sorry for bad English, good code!
thank you for your suggestion, I already published my config file but I didn't see the setting I needed here
i am using middleware on routes
Route::group(
[
'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(),
'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']
], function () {
Route::get('/cities', function(){
// my routes
});
)};
this middleware redirect all requests correctly but i need disable redirects only 404 requests. do you have any idea?
yapılandırma dosyası
config/laravellocalization.php
ancak oluşturma için bunu kullanmalıdır:php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
yani yapılandırma dosyası otomatik olarak oluşturulur. Eğer kullanıyorsanız,Laravel 10.X
sanırım uyumlu değil. çözüm için şöyle kullanıyorum:<a href="{{Laravellocalization::localizeUrl('/anythink')}}">Link</a>
. böylece URL'leriniz şu şekilde değişir: `` http://127.0.0.1:8000/en/anythink` Kötü İngilizce için üzgünüm, iyi kod!önerin için teşekkür ederim, zaten yapılandırma dosyamı yayınladım ama ihtiyacım olan ayarı burada görmedim
rotalarda ara yazılım kullanıyorum
Route::group( [ 'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath'] ], function () { Route::get('/cities', function(){ // my routes }); )};
bu ara yazılım tüm istekleri doğru bir şekilde yönlendirir, ancak yalnızca 404 isteği yönlendirmeleri devre dışı bırakmam gerekir. herhangi bir fikrin var mı?
I couldn't see any settings to disable 404 requests. Maybe others know. If I come across it, I'll post it here.