以IIS10 下设置伪静态规则为例:
1、首先需要安装Url重写模块,百度搜索,下载完安装,URL Rewrite Module。
2、然后重启机器,可以在iis全局看到URL rewrite模块。
3、然后点击要设置伪静态规则的站点,双击“URL 重写”图标。
4、然后进入“URL 重写”界面,点击右侧的“导入规则”。
5、进入“导入 mod_rewrite”界面,点击配置文件下面框最后的三个点。
6、找到伪静态规则文件:.htaccess,选中并点击打开。
7、回到“导入 mod_rewrite”界面,点击“导入”规则。
8、最后,点击右栏的“应用”按钮。
9、至此伪静态配置完成,iis上的伪静态规则是写在web.confg,在网站根目录上web.confg已写上相关程序规则
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
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)