Geta / 404handler

The popular 404 handler for EPiServer, enabling better control over your 404 page in addition to allowing redirects for old urls that no longer works.
Apache License 2.0
56 stars 51 forks source link

Redirects rules not working (URL is not redirecting) #222

Closed Aparna-C closed 3 years ago

Aparna-C commented 3 years ago

We are using version 1.0.0.

We are experiencing issues where URL redirects not working when we add new URL.

We can see all redirect rules in EPiServer Dashboard gadget and also in the database table. Also we are getting successful message after adding redirect rule. but URL is not redirecting.

Thanks in advance for your help.

marisks commented 3 years ago

First of all, upgrade the package to the latest version 1.2.1: https://nuget.optimizely.com/package/?id=Geta.404Handler

Then please explain how you are testing redirects. What URL is not redirected where. I need good examples to understand your issue.

Aparna-C commented 3 years ago

Hello Marisks,

Thanks for your reply.

I have updated the version and seems that EPiServer site is redirecting. (Ex- Old URL - https://www.knowhae.com/xsxcs New URL - https://www.knowhae.com/) But we are trying to redirect WordPress site. (Ex - Old URL - https://www.de.huntersyndrome.info/public/home/hshfshfs New URL - https://www.leben-mit-hunter.de/). New URL is the EPiServer site. So we are trying to redirect WordPress site to EPiServer site. This redirection is not working.

Note - The WordPress site is going to decommission hence we need to implement this redirection.

Regards, Aparna

marisks commented 3 years ago

I your case WordPress should handle redirects, not the Episerver site.

evest commented 3 years ago

You need a way for the Episerver site to get the decommissioned URLs, which means the old domains could be pointed to the new Episerver site. Then you'll get 404 errors that you can redirect.

Aparna-C commented 3 years ago

Hello,

Thanks Evest. We have one more scenario where we want redirection. We have link reference to PDF and that PDF has expired. When we click on the link it is giving 404. We want to redirect this PDF to another PDF. Is this possible through this NuGet?

Regards, Aparna

evest commented 3 years ago

Yes, but as long as the PDF exists in the Episerver file system, the system itself will return the 404 and not redirect it to the handler (because the file actually exists, we just can't show it.)

Rename or delete the expired pdf, and it should generate a regular 404 that you can redirect.

Aparna-C commented 3 years ago

Hello evest,

I have followed the below steps -

1) I have expired the renamed PDF. So now it is giving me the 404 error message. (https://com-corp-prep2.cms.takeda.com/Recycle-Bin/20130424-1ba13launchpressreleasefinal1.pdf)

2) Later I have added entry in gadget. (URL https://com-corp-prep2.cms.takeda.com/Recycle-Bin/20130424-1ba13launchpressreleasefinal1.pdf and new URL https://com-corp-prep2.cms.takeda.com/4ab560/siteassets/system/newsroom/shire-press-releases/2013/august/notification-of-major-interests-in-shares/20130805-1transactioninownshares.pdf successfully saved.)

But still it is not redirecting. (Page URL - https://com-corp-prep2.cms.takeda.com/newsroom/shire-news-releases/2013/brave-awards-now-accepting-nominations/)

Screenshot

Could you please help.

Regards, Aparna

marisks commented 3 years ago

And this is on the Episerver site? https://com-corp-prep2.cms.takeda.com/Recycle-Bin/20130424-1ba13launchpressreleasefinal1.pdf

evest commented 3 years ago

When I visit: https://com-corp-prep2.cms.takeda.com/Recycle-Bin/20130424-1ba13launchpressreleasefinal1.pdf I get a 301 Moved Permanently with Location: https://com-corp-prep2.cms.takeda.com/4ab560/siteassets/system/newsroom/shire-press-releases/2013/august/notification-of-major-interests-in-shares/20130805-1transactioninownshares.pdf

So:

  1. People with the old url will get the new one. This works as intended.
  2. On the page "brave-awards-now-accepting-nominations", the link indeed goes to the old url, and gets redirected for me. to the new Press Release.
  3. The url shown on the page points to the recycle bin, but that is probably because it was deleted or moved there. Episerver detects this, and changes all links, as long as the file still exists.

From what I can see, this is working now, or did I misunderstand.

Aparna-C commented 2 years ago

Hello Evest,

We have added below redirection. but still it is giving 404 error. image

We have renamed this file (/en-gb/home/what-we-do/our-products/combined-advate-adynovi-pi-sept-21.pdf) too in system.

image

URL - https://www.takeda.com/4a724b/siteassets/en-gb/home/what-we-do/our-products/combined-advate-adynovi-pi-sept-21.pdf

Could you please help us because we are still facing this 404 issue.

Thanks in advance.

Regards, Aparna Chaudhari

marisks commented 2 years ago

@Aparna-C Can you check if pdf is not added to "Ignored extensions" in the configuration? https://github.com/Geta/404handler#specifying-ignored-resources

Aparna-C commented 2 years ago

Hello Marisks,

No, there is no extension added for pdf.

Regards, Aparna

marisks commented 2 years ago

Could it be that PDFs are not handled by ASP.NET? Maybe result cached in Cloudflare or somewhere else? Then 404 handler will not be able to do anything if the request never hits ASP.NET.

Aparna-C commented 2 years ago

Hello Marisks,

We will check for cache in Cloudflare. but we are struggling to redirect PDF. We have lots of issues pending related to redirection. We have two instances where the gadget is not working properly. 1) The PDF file url is not redirecting even if we have expired, renamed or deleted the PDF. (https://com-corp-prod2.cms.takeda.com/4a724b/siteassets/en-gb/home/what-we-do/our-products/combined-advate-adynovi-pi-sept-21.pdf) 2) 404 project url is also not redirecting. (Old - https://www.de.huntersyndrome.info/public/home/ and New - https://www.leben-mit-hunter.de/)

Regards, Aparna

marisks commented 2 years ago
  1. Is https://www.de.huntersyndrome.info/public/home/ an Episerver site? Regarding the 1. you have to make sure that the request is handled by ASP.NET.
Aparna-C commented 2 years ago

Hello Mariska,

Yes that is the episerver site. 1. Could you please guide us how we can sure that the request is handled by ASP.NET?

Regards, Aparna

marisks commented 2 years ago
  1. I can't help you with checking out if it is handled by ASP.NET.
  2. Checked that URL and it doesn't seem like Episerver site or it is stopped. Without running site in that URL and without 404 handler there, it will not work.