Implement pseudo-static via windows+iis script mapping method (including asp.net)
Published: 2014-12-24
I. Windows2008, 2012 or higher systems
You only need to create a web.config file in the directory where the script mapping is set, with the following content:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="ttt-map" path="*.ttt" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="File" preCondition="classicMode,runtimeVersionv4.0,bitness32" /> </handlers> </system.webServer> </configuration>
Note: The code on the line where name="ttt-map" is located sets the mapping of files with the .ttt extension to aspnet4.0 or aspnet4.5. Please modify the path="*.ttt" part as needed.
II. Other examples:
1. Map files with the .html extension to aspnet2.0 or aspnet3.5
<add name="html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="File" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
2. Map files with the .html extension to asp
<add name="html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" preCondition="bitness32" />
3. Map files with the .html extension to php5.2 ISAPI mode, 5.2 CGI mode, 5.3, and 5.4 versions (the corresponding paths for our virtual hosting)
<add name="html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:\php_52\php5isapi.dll" resourceType="File" preCondition="bitness32" /> <add name="html" path="*.html" verb="*" modules="CgiModule" scriptProcessor="C:\php_52\php.exe" resourceType="File" preCondition="bitness32" /> <add name="html" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\php_53\php.exe" resourceType="File" preCondition="bitness32" /> <add name="html" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\php_54\php-cgi.exe" resourceType="File" preCondition="bitness32" />
Note: If it is already an aspnet application, you can directly add the corresponding mapping code in the handlers section of system.webServer. In addition, you need to switch the application pool to classic mode and enable the 32-bit compatibility script mapping setting for it to take effect.
If you need to set up a global wildcard mapping, simply enable it in Control Panel - Pseudo-static Settings - .NET Wildcard Mapping.
