Convert .htaccess to web.config

后端 未结 1 970
时光说笑
时光说笑 2020-12-06 19:54

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 fo

相关标签:
1条回答
  • 2020-12-06 20:32

    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>
    
    0 讨论(0)
提交回复
热议问题