Last post Sep 20, 2017 05:55 PM by PatriceSc
Sep 20, 2017 03:40 PM|RageRiot|LINK
I have an expired (Web forms) website and have discovered that many visitors created bookmarks to lower-level pages within the site.
I have a message at root (default) advising people of the new URL (It needs to be done this way, I'm not worried about SEO impact).
What would I need to specify in the web.config to redirect all page requests (and folders such as mydomain.com/news/) to the root (obviously avoiding redirecting the root requests)?
Sep 20, 2017 03:46 PM|PatriceSc|LINK
My first though would be to use
https://www.dotnetperls.com/customerrors to direct 404 not found errors to my root page.
Sep 20, 2017 03:51 PM|RageRiot|LINK
Thanks, however that doesn't seem to work (I see get the 404).
<compilation debug="true" targetFramework="4.5.2"/>
<customErrors defaultRedirect="/default.htm" mode="On"/>
Sep 20, 2017 05:23 PM|KathyW|LINK
Is this what you are looking for?
Sep 20, 2017 05:55 PM|PatriceSc|LINK
Ah old habit. This is https://docs.microsoft.com/en-us/iis/configuration/system.webServer/httpErrors/ which should handle that at the IIS level rather than just
at the ASP.NET level.
Url rewriting as suggested by KathyW is another way but I tend to dislike this a bit (it is used for a bunch of unrelated things even when you have more specialized and simpler options).