IIRF URL重写以强制使用www前缀:example.com-> www.example.com [英] IIRF URL rewrite to force www prefix: example.com -> www.example.com

查看:75
本文介绍了IIRF URL重写以强制使用www前缀:example.com-> www.example.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在iirf中做一些非常简单的事情.

I'm trying to do something pretty simple in iirf.

我希望所有缺少www的请求.加上前缀.

I want all requests that are missing the www. prefix to have it added.

这是我的IsapiRewrite4.ini:

This is my IsapiRewrite4.ini:

RewriteCond %{HTTP_HOST} ^example\.com$ [I]
RewriteRule ^(.*)$ www.example.com/$1 [R=301,L]

这是我的SampleUrls.txt:

This is my SampleUrls.txt:

example.com
example.com/grants
www.example.com
www.example.com/grants

我将文件放置在与TestDriver.exe相同的目录中,然后运行testdriver -d. 所有测试都将被忽略:

I place the files in the same directory as TestDriver.exe, and run testdriver -d . All the tests are ignored:

NO ACTION 'example.com' ==> --

NO ACTION 'example.com/grants' ==> --

NO ACTION 'www. example.com' ==> --

NO ACTION 'www. example.com/grants' ==> --

谢谢

阿什利

推荐答案

TestDriver是测试IIRF重写规则的独立工具.不幸的是,该工具有局限性,因为它无法有效评估测试服务器变量的条件.在基于控制台的独立应用程序中没有服务器变量.

The TestDriver is a standalone tool to test rewrite rules for IIRF. Unfortunately, the tool is limited, in that it cannot effectively evaluate conditions that test Server variables. There are no server variables in a standalone console-based application.

检查文档 .它是这样的:

请注意:TestDriver.exe程序是有用的测试工具,但不能,并且不能代替Web服务器上下文中的实际测试.该测试驱动程序不能在HTTP服务器的上下文中运行,因此不能与HTTP Server变量一起使用.特别是,如果在用TestDriver.exe测试的ini文件中使用RewriteCond,并且那些RewriteCond语句引用了服务器变量(例如%{HTTP_URL}或%{HTTP_REFERER}),则这些RewriteCond语句在TestDriver中的行为将不同它们在ISAPI中的行为方式.对这些条件的测试对验证实际的操作性能将无用.

Please note: the TestDriver.exe program is a useful testing tool, but it does not and cannot replace actual testing in the context of a web server. The testdriver does not run within the context of an HTTP server, and so does not work with HTTP Server variables. In particular, if you use RewriteCond in the ini files that you test with TestDriver.exe, and those RewriteCond statements reference Server variables (eg %{HTTP_URL} or %{HTTP_REFERER}) , those RewriteCond statements will not behave in the TestDriver the same way they will behave in an ISAPI. Tests of such conditions will not be useful in verifying actual operational performance.

这篇关于IIRF URL重写以强制使用www前缀:example.com-> www.example.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆