首页服务器Web服务器 htaccess转换httpd.ini的方法

htaccess转换httpd.ini的方法

从apache转到iis下,碰到.htacess转换httpd.ini的问题,经过摸索得出以下 结论大家可以试试,不一定对。 先来看.htacess中源代码 RewriteEngine On RewriteCond %{H…

从apache转到iis下,碰到.htacess转换httpd.ini的问题,经过摸索得出以下

结论大家可以试试,不一定对。 先来看.htacess中源代码

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.45it.net$
RewriteRule ^(.*)$ http://www.45it.net/$1 [R=301,L,NC]
RewriteBase /

RewriteRule ^([^-//./_/-]+)/.html$ $1.php?
RewriteRule ^([^-//./_/-]+)-op([^-/]+)-sor([^-/]+)-det([^-/]+)/.html$$1.php?op=$2&sor=$3&det=$4
RewriteRule ^([^-//./_/-]+)-op([^-/]+)-sor([^-/]+)/.html$ $1.php?op=$2&sor=$3
RewriteRule ^([^-//./_/-]+)-sor([^-/]+)/.html$ $1.php?sor=$2
RewriteRule ^([^-//./_/-]+)-op([^-/]+)/.html$ $1.php?op=$2
RewriteRule ^([^-//./_/-]+)-page([^-/]+)/.html$ $1.php?page=$2
RewriteRule ^([^-//./_/-]+)-op([^-/]+)-sor([^-/]+)-page([^-/]+)/.html$$1.php?op=$2&sor=$3&page=$4

接下来看转换后http.ini的写法

[ISAPI_Rewrite]
RewriteRule /([^-//./_/-]+)/.html$ /$1.php?
RewriteRule /([^-//./_/-]+)-op([^-/]+)-sor([^-/]+)-det([^-/]+)/.html$/$1.php?op=$2&sor=$3&det=$4
RewriteRule /([^-//./_/-]+)-op([^-/]+)-sor([^-/]+)/.html$ /$1.php?op=$2&sor=$3
RewriteRule /([^-//./_/-]+)-sor([^-/]+)/.html$ /$1.php?sor=$2
RewriteRule /([^-//./_/-]+)-op([^-/]+)/.html$ /$1.php?op=$2
RewriteRule /([^-//./_/-]+)-page([^-/]+)/.html$ /$1.php?page=$2
RewriteRule /([^-//./_/-]+)-op([^-/]+)-sor([^-/]+)-page([^-/]+)/.html$/$1.php?op=$2&sor=$3&page=$4

在.htacess转换httpd.ini转换结果汇中大家明显看到我们做了修改的几个地方

有颜色的部分就是修改过的,在.htacess转换httpd.ini转换中就是要让apache和iis理解我们想要它做什么

上面代码不难看出:

首先是对规则的定义要变,从rewrite_module变成isapi_rewrite 其次是路径要变,.htacess的路径是定义在头部中,而httpd.ini是定义在每行规则里,.htacess转换httpd.ini转 换时将.htacess中^符号换成/,在独立页面前面加上路径/,以我自己理解这个/应该是相对目录的根目录。

本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/fwq/web/7199.html
上一篇什么是应用服务器Application Server
下一篇 远程连接服务器for linux
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部