Asp/Aspx程序如何设置伪静态/重定向等功能

说明: Asp/Aspx程序一般都有默认的一套配置文件,所以面板暂不支持自动配置伪静态功能,需要自己手动配置。 web.…

说明:
Asp/Aspx程序一般都有默认的一套配置文件,所以面板暂不支持自动配置伪静态功能,需要自己手动配置。
web.config路径在网站(站点)根目录下

如何手动配置?

分为两种情况,情况如下:

1、当Asp程序根目录不存在web.config文件,或者配置文件内容为如下代码时:

可以直接将面板生成的代码复制到伪静态,保存即可

  1. <?xml version=”1.0″ ?>
  2. <configuration>
  3.     <location allowOverride=”false” inheritInChildApplications=”false” path=”.”>
  4.         <system.webServer>
  5.             <rewrite>
  6.                 <rules configSource=”web_config\rewrite.config”></rules>
  7.             </rewrite>
  8.             <defaultDocument configSource=”web_config\default.config”></defaultDocument>
  9.             <httpErrors configSource=”web_config\httpErrors.config”></httpErrors>
  10.             <handlers configSource=”web_config\php.config”></handlers>
  11.         </system.webServer>
  12.     </location>
  13. </configuration>

复制代码

2、当Aspx程序和Asp程序根目录自带了web.config文件时:
如原配置为以下格式:

Asp/Aspx程序如何设置伪静态/重定向等功能-1

3、(重要)当Asp网站不存在原有配置文件时,将网站目录下的web.config文件内容替换成以下代码即可

  1. <?xml version=”1.0″ ?>
  2. <configuration>
  3.         <location path=”.” allowOverride=”false” inheritInChildApplications=”false”>
  4.           <system.webServer>
  5.                <rewrite>
  6.                      <rules>
  7.                          <rule name=”http_toHttps” stopProcessing=”true”>
  8.                              <match url=”(.*)”/>
  9.                              <conditions>
  10.                                   <add input=”{HTTPS}” pattern=”off” ignoreCase=”true”/>
  11.                              </conditions>
  12.                              <action type=”Redirect” redirectType=”Permanent” url=”https://{HTTP_HOST}/{R:1}”/>
  13.                              </rule>
  14.                      </rules>
  15.                 </rewrite>
  16.           </system.webServer>
  17.         </location>
  18. </configuration>

复制代码

手动修改后的代码:

注意1:如果【图1】中存在<system.webServer>/<rewrite>/<rules>,则直接加入在下级节点
注意2:如果【图1】中不存在<system.webServer>/<rewrite>/<rules>,则需要手动添加,下图为手动添加【<system.webServer>/<rewrite>/<rules>】

Asp/Aspx程序如何设置伪静态/重定向等功能-1

为您推荐

如何下载Windows 版本最新Mysql 安装包?

如何下载Windows 版本最新Mysql 安装包? 访问官网地址:https://www.mysql.com 1.点击...

Windows Server 2019 配置IIS支持伪静态

Windows Server 2019 配置IIS支持伪静态 准备篇 一、环境说明: 操作系统:Windows Serv...

Windows Server 2019 安装Mysql8.0

Windows Server 2019 如何安装 Mysql8.0 准备篇 一、环境说明: 操作系统:Windows S...

Windows Server 2019 安装PHP

Windows Server 2019 如何安装 IIS10 imgSpider 采集中… 准备篇 一、环境...

windows宝塔面板如何优化apache性能?

请仔细阅读此教程,否则您的Apache可能将异常关闭!!! Timeout : 请求的超时时间 KeepAliveTim...
返回顶部