RewriteEngine On
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?:www.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://%2%3 [R=301,L]
RewriteCond %{HTTP_Host} ([^.]+).itsprofile.com$ [NC]
RewriteRule (.*) http://itsprofile.com/viewindex.php$1?id =%1 [NC,L]
1 に答える
            1        
        
		
web.configに変換すると言うときは、.htaccess書き換えルールをIISURL書き換えルールに変換することを意味すると想定します。.htaccessルールをIISURLRewriteにインポートする方法については、こちらをご覧ください。
上記の書き換えルールがインポートされ、次のように変換されます。
<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url=".?" ignoreCase="false" />
      <conditions>
        <add input="{HTTPS}" pattern="(on)?" ignoreCase="false" />
        <add input="{HTTP_HOST}" pattern="^(?:www.)(.+)$" />
        <add input="{URL}" pattern="(.+)" ignoreCase="false" />
      </conditions>
      <action type="Redirect" redirectType="Permanent" url="http(?{C:1}s)://{C:2}{C:3}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 2">
      <match url="(.*)" ignoreCase="false" />
      <conditions>
        <add input="{HTTP_Host}" pattern="([^.]+).itsprofile.com$" />
      </conditions>
      <action type="Redirect" redirectType="Found" url="http://itsprofile.com/viewindex.php{R:1}?id" appendQueryString="false" />
    </rule>
  </rules>
当然、すべてのルールをテストする必要があります。
于 2012-10-12T04:17:03.303   に答える