2012-10-09 49 views
0
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] 
+0

你有什麼試過?你的問題是什麼?你想要達到什麼目的?你不能只是傾倒一小塊代碼,並希望我們要爲你解決你的問題... – slugonamission

+0

是的,好友,我一直試圖做超過3個小時。我不知道如何轉換它。我看到一些'教程',但他們需要IIS進行轉換。認爲可能有些人可以幫助我解決這個問題。我不要求任何人爲我做這件事。一些建議會做。我現在空白了。 – Ketan

回答

1

當你說轉換爲web.config時,我假設你的意思是將.htaccess重寫規則轉換爲IIS URL重寫規則。您可以找到有關將.htaccess規則導入到IIS URL重寫here的信息。

你重寫規則上面會被導入並轉換到這一點:

<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> 

當然,你需要測試所有規則。