mpe*_*pen 3 apache iis mod-rewrite iis-7 url-rewriting
我一直使用apache,所以我对IIS完全不熟悉.我将如何在IIS中执行此操作?
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)
我已经打开IIS管理器,我正在查看"URL重写",只需单击"添加规则".我认为这是我想去的地方,但我不知道从哪里开始.
对于那些了解IIS而不是apache的mod_rewrite的人来说,它只是检查请求是不是目录也不是文件,如果是,则获取请求URL并将其作为GET参数传递给index.php,以便它可以用代码处理,用路由器.
Car*_*res 10
您可以自动导入它们,只需转到所需的站点或应用程序,然后双击URL Rewrite图标,然后使用任务列表中的Import Rules ...链接.在该UI中,只需复制/粘贴上面的规则并单击"确定",它就会将这些规则导入到您的web.config中.
你的web.config中的等价物将是(当然在配置/ system.webServer ......等):
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
有关如何导入它们的更多信息:http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/
归档时间: |
|
查看次数: |
2438 次 |
最近记录: |