Open efraimlorenzana opened 2 months ago
Yes, this should work. Maybe you left this flag enabled from the appsettings.json? And that's why it gets overwritten.
"Geta": {
"NotFoundHandler": {
"Optimizely": {
"AutomaticRedirectsEnabled": true
}
}
}
Hello,
No we never add this settings in our appsettings.json file, we have configured it via services as below:
services.AddOptimizelyNotFoundHandler(o => { o.AutomaticRedirectsEnabled = false; });
I checked in the sandbox app, and the move event stops firing if AutomaticRedirectsEnabled
is set to false
.
Could you also check whether a record is always created in the ContentUrlHistory table when content is moved?
I suggest also disabling the following two jobs that are related to Automatic Redirects:
[Geta NotFoundHandler] Index Content URLs
[Geta NotFoundHandler] Register Content Move Redirects
Hello, as per checking, the two scheduled jobs are not running automatically either, and no the content that was moved are not created in the ContentUrlHistory. I can reproduce the issue both in my local project and also in live environment.
Thank you for testing and providing information.
Here’s how automatic redirects actually work:
When content is moved, a record is created in the ContentUrlHistory
table. A job or background service then checks the records in this table to generate redirects.
Maybe we are talking about different things? From your previous comment, it seems that ContentUrlHistory
wasn’t affected. How did you identify that the problem exists?
Let me share my perspective on how the issue appears from my end. When I create a new page (e.g., /wecare), it is saved in the ContentUrlHistory table with the following information: [{"Url":"/we-care/","Type":"Primary","Language":"en-GB"}].
If I then rename the page to /we-care-2 and check the NotFound Handler Redirects, I notice that a new entry is automatically created for this URL (Old URL: https://jderetail-test-whitelabel.jdecoffee.net/we-care/ & New URL: https://jderetail-test-whitelabel.jdecoffee.net/we-care-2/). Since AutomaticRedirectsEnabled is set to false, I wouldn’t expect redirects to be created automatically for any renamed URL, but that seems to be happening here.
Additionally, when I check the database, I don’t see any data reflecting /we-care-2; only the original entry from when the page was first created is present: [{"Url":"/we-care/","Type":"Primary","Language":"en-GB"}].
Given this outcome, do you think we might be looking at the issue from different perspectives?
Based on the previous comment, it appears that the AutomaticRedirectsEnabled
flag is set to enabled. I don't have any other ideas at the moment.
You could try replicating this issue in the sandbox app included in the package, or debug the initialization of Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects.ContentUrlHistoryEvents
in your solution to check if the events are being registered.
Hi there,
I'm using this package to handle NotFound redirects in our Optimizely CMS project. I’ve run into an issue where setting "AutomaticRedirectsEnabled" to false doesn’t seem to stop redirects from being created when I move or rename a page.
What I have in the configuration: services.AddOptimizelyNotFoundHandler(o => { o.AutomaticRedirectsEnabled = false; });
What I Expected: No automatic redirects should be created when AutomaticRedirectsEnabled is set to false.
What Actually Happened: Redirects are still being created automatically even though I’ve disabled that feature.
Environment: Optimizely CMS Version: 12.30.0 Geta.NotFoundHandler.Optimizely Version: 5.0.8 .NET Core Version: net6.0
I’ve double-checked the documentation, and it seems like this should be working, so I’m not sure what’s going wrong. Any chance you could take a look?
Thanks!