我真的被困在这里,这让我发疯。我已经搜遍了,但我看不出我在这里做错了什么。
我正在使用 ISAPI_ModRewrite 移动以前在 Windows 服务器上的应用程序,因此它可以与 htaccess 一起使用,我正在尝试将其移动到我无法安装 ISAPI 作为其共享托管环境的 windows-server 2008 服务器。
下面是我想要做的,但这只是返回一个 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>