Isapi_Rewrite中httpd.conf和.htaccess配置规则的区别详解
我们知道,配置伪静态有两种类型的文件,httpd.conf和.htaccess
今天在使用ISAPI_Rewrite3为各个站点配置伪静态时,
发现在全局httpd.conf中配置的伪静态规则可使用,而把配置规则拷贝到网站根目录的.htaccess文件,
并清空全局httpd.conf后却后现伪静态无法使用了。
后来在官网看到了:
If rules are working in httpd.conf file but not in other sections or .htaccess files, make sure to include RewriteEngine on directive in every section and .htaccess file. Also remember that rewriting base inside .htaccess files by default is different from httpd.conf. ISAPI_Rewrite automatically strips the local directory prefix from the path when in .htaccess or
section and applies rules only to the remainder. So if your rules start with a ‘/’ character, this should be removed in .htaccess file in the root folder of web site.
原来httpd.conf和.htaccess的规则还是不太一样
如:
httpd.conf中的配置规则是:
1 | RewriteRule /(\w+)/list(\d+).html /Article/ArticleList.aspx\?ArticleType=$1&Page=$2 |
.htaccess中的配置规则需要修改为:
1 | RewriteRule (\w+)/list(\d+).html /Article/ArticleList.aspx\?ArticleType=$1&Page=$2 |
根据规则慢慢改过来就可以了。
去除WordPress评论框下方的提示内容方法 jQuery中setInterval、setTimeout的用法和区别