华域联盟 Linux apache伪静态与iis伪静态规则与配置区别介绍

apache伪静态与iis伪静态规则与配置区别介绍

本文章来总结一下关于apache伪静态与iis伪静态区别介绍,主要讲到了一些规则的问题与配置区别,以后大家就可以直接在iis伪静态转换apache,反之也很简单哦。

在我开时打开模式不一样
apache的.htaccess配置文件是以:RewriteEngine On 将写模式打开。
Apache伪静态html(URL Rewrite)设置法
phpma一 打开 Apache 的配置文件 httpd.conf 。
phpma二 将#LoadModule rewrite_module modules/mod_rewrite前面的#去掉
phpma三 在 httpd.conf中添加:

复制代码 代码如下:

<IfModule mod_rewrite.c>

RewriteEngine On

#RewriteCond %{ENV:SCRIPT_URL} (?:index|dispbbs)[-0-9]+.html

RewriteRule ^(.*?(?:index|dispbbs))-([-0-9]+).html$ $1.php?

__is_apache_rewrite=1&__rewrite_arg=$2

</IfModule>

iis的httpd.ini配置文件是以:[ISAPI_Rewrite] 将写模式打开。

打开你的httpd.ini,找到

[ISAPI_Rewrite]

复制代码 代码如下:

# 3600 = 1 hour

CacheClockRate 3600

RepeatLimit 32

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

# from accessing through HTTP

RewriteRule ^(.*)/archiver/([a-z0-9-]+.html)$ $1/archiver/index.php?$2

RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+).html$ $1/forumdisplay.php?fid=$2&page=$3

RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3

RewriteRule ^(.*)/profile-(username|uid)-(.+?).html$ $1/viewpro.php?$2=$3

更多详细内容请查看:
https://www.cnhackhy.com/article/29390.htm



区别
apache不需要网站域名,而iis需要网站域名,且IIS遇到需要重写的URL有问号(?)与点(.)时,需要增加()进行转义.

区别如下

iis:


复制代码 代码如下:

RewriteRule ^(.*)/category(d+).html$ $1/index.php?catid=$2

apache: 


复制代码 代码如下:

RewriteRule ^category(d+).html$ index.php?catid=$1 [QSA,L]

您可能感兴趣的文章:

本文由 华域联盟 原创撰写:华域联盟 » apache伪静态与iis伪静态规则与配置区别介绍

转载请保留出处和原文链接:https://www.cnhackhy.com/45311.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

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

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

微信扫一扫关注我们

关注微博
返回顶部