IIS下的伪静态规则怎么写

IIS下的伪静态规则怎么写,第1张

IIS服务器下ISAPI_Rewrite伪静态规则

[ISAPI_Rewrite]

# 3600 = 1 hour

CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files

# from accessing through HTTP

#heads

RewriteRule ^(.*)/Contact\.html\?*(.*)$ $1/index.\php\?pag=contact

RewriteRule ^(.*)/Manual-Submit-Software\.html\?*(.*)$ $1/index.\php\?a=pad&manual_submit

#others

RewriteRule ^(.*)/New\.html\?*(.*)$ $1/index.\php\?pag=new_prog&days=30

RewriteRule ^(.*)/New/Page(.*)\.html\?*(.*)$ $1/index.\php\?pag=new_prog&days=30&page=$2

RewriteRule ^(.*)/Today-New\.html\?*(.*)$ $1/index.\php\?pag=new_prog&days=1

RewriteRule ^(.*)/Today-New/Page(.*)\.html\?*(.*)$ $1/index.\php\?pag=new_prog&days=1&page=$2

RewriteRule ^(.*)/New-Hot\.html\?*(.*)$ $1/index.\php\?pag=new_prog&days=7&hits=10

RewriteRule ^(.*)/New-Hot/Page(.*)\.html$ /index.\php\?pag=new_prog&days=7&hits=10&page=$2

RewriteRule ^(.*)/Downloads\.html\?*(.*)$ $1/index.\php\?pag=downloads

RewriteRule ^(.*)/Downloads/Page(.*)\.html\?*(.*)$ $1/index.\php\?pag=downloads&page=$2

#reviews

RewriteRule ^(.*)/ReadReview-(.*)\.html\?*(.*)$ $1/index.\php\?pag=read_review&id=$2&c

RewriteRule ^(.*)/AllReviews-(.*)\.html\?*(.*)$ $1/index.\php\?pag=all_reviews&id=$2&c

RewriteRule ^(.*)/Reviews-(.*)\.html\?*(.*)$ $1/index.\php\?pag=user_reviews&username=$2&c

#user 1

RewriteRule ^(.*)/Delete-Review-(.*)\.html\?*(.*)$ $1/index.\php\?a=user&b=reviews&delete=$2

RewriteRule ^(.*)/Edit-Review-(.*)\.html\?*(.*)$ $1/index.\php\?a=user&b=reviews&edit=$2

#report page

RewriteRule ^(.*)/Report/file-(.*)\.html\?*(.*)$ $1/index.\php\?pag=report&b=$2

#send friend

RewriteRule ^(.*)/Send-Friend/file-(.*)\.html\?*(.*)$ $1/index.\php\?pag=send_friend&b=$2

#users links

RewriteRule ^(.*)/User-Panel\.html\?*(.*)$ $1/index.\php\?a=user

RewriteRule ^(.*)/My-Settings\.html\?*(.*)$ $1/index.\php\?a=user&b=profil

RewriteRule ^(.*)/My-Alerts\.html\?*(.*)$ $1/index.\php\?a=user&b=alerts

RewriteRule ^(.*)/My-Reviews\.html\?*(.*)$ $1/index.\php\?a=user&b=reviews

RewriteRule ^(.*)/Change-Pass\.html\?*(.*)$ $1/index.\php\?a=user&b=profil&pass

RewriteRule ^(.*)/Log-Out\.html\?*(.*)$ $1/index.\php\?a=user&b=logout

RewriteRule ^(.*)/Register-Form\.html\?*(.*)$ $1/index.\php\?pag=register

RewriteRule ^(.*)/Lost-Password-Form\.html\?*(.*)$ $1/index.\php\?pag=password

RewriteRule ^(.*)/Resend-Confirmation-Email\.html\?*(.*)$ $1/index.\php\?pag=resend_email

#categorii

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)\.html\?*(.*)$ $1/index.\php\?os=$2&cat=$3

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)\.html\?*(.*)$ $1/index.\php\?os=$2&cat=$3&subcat=$4

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/Page(.*)\.html\?*(.*)$ $1/index.\php\?os=$2&cat=$3&subcat=$4&page=$5

#program download

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/file_(.*)_1\.html\?*(.*)$ $1/index.\php\?a=prog&os=$2&cat=$3&subcat=$4&det=$5&dwn

#program buy

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/file_(.*)_2\.html\?*(.*)$ $1/index.\php\?a=prog&os=$2&cat=$3&subcat=$4&det=$5&buy

#program images

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/file_(.*)_4\.html\?*(.*)$ $1/index.\php\?a=prog&os=$2&cat=$3&subcat=$4&det=$5&img

#program autor

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/file_(.*)_5\.html\?*(.*)$ $1/index.\php\?a=prog&os=$2&cat=$3&subcat=$4&det=$5&pub

#program reviews

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/file_(.*)_3\.html\?*(.*)$ $1/index.\php\?a=prog&os=$2&cat=$3&subcat=$4&det=$5&rev

#program general

RewriteRule ^(.*)/([a-zA-Z\-]+)/([a-zA-Z\-]+)/([a-zA-Z0-9\-]+)/file_(.*)\.html\?*(.*)$ $1/index\.php\?a=prog&os=$2&cat=$3&subcat=$4&det=$5

RewriteRule ^(.*)/([a-zA-Z\-]+)\.html\?*(.*)$ $1/index\.php\?os=$2

设置伪静态规则的具体步骤如下:

以IIS10下设置伪静态规则为例:

1、首先需要安装Url重写模块,百度搜索,下载完安装,URLRewriteModule。

2、然后重启机器,可以在iis全局看到URLrewrite模块。

3、然后点击要设置伪静态规则的站点,双击“URL重写”图标。

4、然后进入“URL重写”界面,点击右侧的“导入规则”。

5、进入“导入mod_rewrite”界面,点击配置文件下面框最后的三个点。

6、找到伪静态规则文件:.htaccess,选中并点击打开。

7、回到“导入mod_rewrite”界面,点击“导入”规则。

8、最后,点击右栏的“应用”按钮。

9、至此伪静态配置完成,iis上的伪静态规则是写在web.confg,在网站根目录上web.confg已写上相关程序规则

你说的那个叫URL重写技术,也叫地址重写,一般对空间是有规则要求的,在不同的环境下重写的规则也不同!

而伪静技术指的是仍然是动态页面(未页后辍无要求,也可能是html静态后辍,但却是一个动态页面),生成cache或者是缓存页面,在更新后初次请求时会是动态页的执行过程,同时将执行的结果写到硬盘或cache中,在下次请求时直接从缓存或硬盘取出,这种以硬盘或内存空间换运行时间的方式叫伪静态技术。

而不少人或书上都把url重写技术称为伪静技术了——这不怪任何人,连百度百科都被编成这样的,错了能怪谁呢?

在IIS中一般是不搭PHP,除非服务器主要支持asp/.net,同时为了保持对PHP的兼容的情况下才会使用IIS搭配php。

其实对于这种url重写技术,你又是新手不打算开发控件或服务器组件时是没有必要清楚它的机理的,只要了解你所下载的组件中,所使用的url的重写规则就可以了!一般这是一个根据组件而定义的一个正则表达式而已,你只要查看它的正则表达式说明,就可以自己写了!


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/396454.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-19
下一篇2023-05-19

发表评论

登录后才能评论

评论列表(0条)

    保存