I've implemented an httpmodule
to manage 301 redirects in the database. It does a simple (cached) db lookup to find any matching entries and if it finds any it performs a redirect.
It works wonderfully for .aspx
files and other .Net related extensions.
However, for paths ending in .html
or /
I'm having a more difficult time. I can add a handler for such files as follows:
<add name="SubDirectory" path="*/*/" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="ForDirectory" path="*/" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="SubHTML" path="*/*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="ForHTML" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
but I've run into two issues:
ForDirectory
handler breaks it. Failed to Execute URL
. Any help would be much appreciated.
Switching IIS to integrated rather than classic mode was/is the solution. No handlers are needed, either.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.