Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Redirects Only for 404 Requests #871

Open
ahmetsmc opened this issue May 29, 2023 · 3 comments
Open

Disable Redirects Only for 404 Requests #871

ahmetsmc opened this issue May 29, 2023 · 3 comments

Comments

@ahmetsmc
Copy link

I couldn't find it in config file, can we disable redirects for some requests or 404 requests?

@alihan0
Copy link

alihan0 commented May 31, 2023

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!

@ahmetsmc
Copy link
Author

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?

@alihan0
Copy link

alihan0 commented Jun 1, 2023

yapılandırma dosyası config/laravellocalization.phpancak 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.Xsanı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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants