转换的.htaccess的web.config [英] Convert .htaccess to web.config

查看:373
本文介绍了转换的.htaccess的web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是IIS-7和我从一个基于Linux和Apache服务器环境在移动网站。我知道的web.config不作为的.htaccess同样的工作。我期待下面的线从我的.htaccess文件转换为web.config文件。我会在哪里开始呢?

 选项+了FollowSymLinks
RewriteEngine叙述上
重写规则([A-ZA-Z0-9 / _-] +)。?(JP(E)G |?GIF | PNG)$ thumb.php SRC = .. / .. /上传/默认/文件/ $ 1。 $ 2及尺寸= 160x90
 

解决方案

要转换的.htaccess规则web.config中,你可以使用IIS的导入功能的 URL重写模块

  1. 转至 IIS管理器
  2. 点击你的网站在树
  3. 双击 URL重写在功能视图
  4. 点击导入规则在动作面板
  5. 您的.htaccess规则粘贴到重写规则的文本框,你会看到下面的转换规则。

更多信息有关此功能。

比如你的规则转换成这些的:

 <改写>
  <规则>
    <规则名称=导入规则1>
      <匹配URL =。([A-ZA-Z0-9 / _-] +)(?JP(E)G | GIF | PNG)$IGNORECASE =FALSE/>
      <作用TYPE =重写URL =thumb.php SRC = .. / .. /上传/默认/文件/ {R:1} {R:2}?&放大器;放大器;大小= 160x90appendQueryString = 假/>
    < /规则>
  < /规则>
< /重写>
 

I'm using IIS-7 and am moving a site over from a linux and apache based server environment. I know web.config does the same job as .htaccess. I'm looking to convert the following lines from my .htaccess file to a web.config file. Where would I begin?

Options +FollowSymlinks
RewriteEngine On
RewriteRule ([A-Za-z0-9/_-]+).(jp(e?)g|gif|png)$ thumb.php?src=../../uploads/default/files/$1.$2&size=160x90

解决方案

To convert rules from .htaccess to web.config you can use import feature of the IIS URL Rewrite Module:

  1. go to IIS Manager
  2. click you site in the tree
  3. double-click URL Rewrite in the Feature View
  4. click Import Rules in the Actions panel
  5. paste your .htaccess rules into the Rewrite rules textbox and you'd see your converted rules below.

More info about this feature.

For instance your rules are converted into these ones:

<rewrite>
  <rules>
    <rule name="Imported Rule 1">
      <match url="([A-Za-z0-9/_-]+).(jp(e?)g|gif|png)$" ignoreCase="false" />
      <action type="Rewrite" url="thumb.php?src=../../uploads/default/files/{R:1}.{R:2}&amp;size=160x90" appendQueryString="false" />
    </rule>
  </rules>
</rewrite>

这篇关于转换的.htaccess的web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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