0
那裏我真的被困在這裏,它讓我瘋狂。我查遍了所有,但我看不出我在這裏做錯了什麼。將htaccess轉換爲web.config導致500錯誤,我看不到,爲什麼?
我正在移動一個以前在windows服務器上使用ISAPI_ModRewrite的應用程序,所以這與htaccess一起工作,我試圖將它移到一個windows服務器2008服務器,我無法安裝ISAPI作爲它的共享託管環境。
下面是我想要做的,但這只是返回一個500內部服務器錯誤任何想法我做錯了什麼?這是htaccess的代碼,我想轉換...
# PRODUCT PAGE
RewriteRule ^([0-9]*)/(.*)/? /prodpage.asp?productid=$1 [L]
# OTHER PAGES
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ /$1.asp [QSA]
RewriteRule ^([^/]+)/([0-9]+)-([0-9]+)/$ /$1.asp?pricerange=$2-$3
RewriteRule ^([^/]+)/([0-9]+)-([0-9]+)/([a-z])/$ /$1.asp?pricerange=$2-$3&sort=$4
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
這是我的web.config文件...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Product Page" stopProcessing="true">
<match url="^([0-9]*)/(.*)/?$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="prodpage.asp?productid={R:1}" appendQueryString="true" />
</rule>
<rule name="Other Page1" stopProcessing="true">
<match url="^([^/]+)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.asp" appendQueryString="true" />
</rule>
<rule name="Other Page2" stopProcessing="true">
<match url="^([^/]+)/([0-9]+)-([0-9]+)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.asp?pricerange={R:2}-{R:3}" appendQueryString="true" />
</rule>
<rule name="Other Page3" stopProcessing="true">
<match url="^([^/]+)/([0-9]+)-([0-9]+)/([a-z])/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.asp?pricerange={R:2}-{R:3}&sort={R:4}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>