虚拟主机域名注册-常见问题其他问题 → 其他问题

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

  说明:

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

  web.config路径在网站(站点)根目录下

  如何手动配置?

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

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

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

<?xml version="1.0" ?>
<configuration>
    <location allowOverride="false" inheritInChildApplications="false" path=".">
        <system.webServer>
            <rewrite>
                <rules configSource="web_config\rewrite.config"></rules>
            </rewrite>
            <defaultDocument configSource="web_config\default.config"></defaultDocument>
            <httpErrors configSource="web_config\httpErrors.config"></httpErrors>
            <handlers configSource="web_config\php.config"></handlers>
        </system.webServer>
    </location>
</configuration>

  2、当Aspx程序和Asp程序根目录自带了web.config文件时:

  如原配置为以下格式:

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

  <?xml version="1.0" ?>
<configuration>
        <location path="." allowOverride="false" inheritInChildApplications="false">
          <system.webServer>
               <rewrite>
                     <rules>
                         <rule name="http_toHttps" stopProcessing="true">
                             <match url="(.*)"/>
                             <conditions>
                                  <add input="{HTTPS}" pattern="off" ignoreCase="true"/>
                             </conditions>
                             <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}"/>
                             </rule>
                     </rules>
                </rewrite>
          </system.webServer>
        </location>
</configuration>

  手动修改后的代码:

  注意1:如果【图1】中存在//,则直接加入在下级节点

  注意2:如果【图1】中不存在//,则需要手动添加,下图为手动添加【//】




免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:bkook@qq.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
【 双击滚屏 】 【 推荐朋友 】 【 收藏 】 【 打印 】 【 关闭 】 【 字体: 】 
上一篇:Windows server服务器允许多用户远程的设置
下一篇:Windows Server 2019 搭建IIS环境
  >> 相关文章
没有相关文章。

服务热线

198-9911-5815

功能和特性

价格和优惠

技术支持及售后

微信关注